diff options
author | Simon Howard | 2013-08-11 17:32:29 +0000 |
---|---|---|
committer | Simon Howard | 2013-08-11 17:32:29 +0000 |
commit | 63acb55b18f024db74fd9a7eedbf3137922630c4 (patch) | |
tree | 625c361f74f661ab3448f165d8bcc0b154379292 /wince/env.c | |
parent | b1d51276a264849ded93ce943eb0283c1f4f1aba (diff) | |
download | chocolate-doom-63acb55b18f024db74fd9a7eedbf3137922630c4.tar.gz chocolate-doom-63acb55b18f024db74fd9a7eedbf3137922630c4.tar.bz2 chocolate-doom-63acb55b18f024db74fd9a7eedbf3137922630c4.zip |
Remove Windows CE support.
What support exists is for obsolete devices I no longer possess; I've
never been contacted about the port and it's been several years since
I even bothered to build a new version. All the extra overrides are
clutter that can just be removed.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2615
Diffstat (limited to 'wince/env.c')
-rw-r--r-- | wince/env.c | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/wince/env.c b/wince/env.c deleted file mode 100644 index c90b4c8d..00000000 --- a/wince/env.c +++ /dev/null @@ -1,92 +0,0 @@ -// -// "Extension" implementation of getenv for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#include <stdlib.h> -#include <string.h> - -#include <windows.h> -#include <lmcons.h> -#include <secext.h> -#include <shlobj.h> - -#include "env.h" - -static void WCharToChar(wchar_t *src, char *dest, int buf_len) -{ - unsigned int len; - - len = wcslen(src) + 1; - - WideCharToMultiByte(CP_OEMCP, 0, src, len, dest, buf_len, NULL, NULL); -} - -static void SetEnvironment(char *env_string, wchar_t *wvalue) -{ - char value[MAX_PATH + 10]; - int env_len; - - // Construct the string for putenv: NAME=value - - env_len = strlen(env_string); - strcpy(value, env_string); - - WCharToChar(wvalue, value + env_len, sizeof(value) - env_len); - - // Set the environment variable: - - putenv(value); -} - -static int ReadOwnerName(wchar_t *value, DWORD len) -{ - HKEY key; - DWORD valtype; - - if (RegOpenKeyExW(HKEY_CURRENT_USER, - L"\\ControlPanel\\Owner", 0, - KEY_READ, &key) != ERROR_SUCCESS) - { - return 0; - } - - valtype = REG_SZ; - - if (RegQueryValueExW(key, L"Name", NULL, &valtype, - (LPBYTE) value, &len) != ERROR_SUCCESS) - { - return 0; - } - - // Close the key - - RegCloseKey(key); - - return 1; -} - -void PopulateEnvironment(void) -{ - wchar_t temp[MAX_PATH]; - - // Username: - - if (ReadOwnerName(temp, MAX_PATH)) - { - SetEnvironment("USER=", temp); - SetEnvironment("USERNAME=", temp); - } - - // Temp dir: - - GetTempPathW(MAX_PATH, temp); - SetEnvironment("TEMP=", temp); - - // Use My Documents dir as home: - - SHGetSpecialFolderPath(NULL, temp, CSIDL_PERSONAL, 0); - SetEnvironment("HOME=", temp); -} - |