ReactOS 0.4.17-dev-806-gffa4164
reg.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "winerror.h"
#include "winuser.h"
#include "winternl.h"
#include "advpub.h"
#include "wine/debug.h"
Include dependency graph for reg.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (advpack)
 
static BOOL get_temp_ini_path (LPWSTR name)
 
static BOOL create_tmp_ini_file (HMODULE hm, WCHAR *ini_file)
 
static void strentry_atow (const STRENTRYA *aentry, STRENTRYW *wentry)
 
static STRTABLEWstrtable_atow (const STRTABLEA *atable)
 
static void free_strtable (STRTABLEW *wtable)
 
HRESULT WINAPI RegInstallA (HMODULE hm, LPCSTR pszSection, const STRTABLEA *pstTable)
 
static HRESULT write_predefined_strings (HMODULE hm, LPCWSTR ini_path)
 
HRESULT WINAPI RegInstallW (HMODULE hm, LPCWSTR pszSection, const STRTABLEW *pstTable)
 
HRESULT WINAPI RegRestoreAllA (HWND hWnd, LPSTR pszTitleString, HKEY hkBackupKey)
 
HRESULT WINAPI RegRestoreAllW (HWND hWnd, LPWSTR pszTitleString, HKEY hkBackupKey)
 
HRESULT WINAPI RegSaveRestoreA (HWND hWnd, LPCSTR pszTitleString, HKEY hkBackupKey, LPCSTR pcszRootKey, LPCSTR pcszSubKey, LPCSTR pcszValueName, DWORD dwFlags)
 
HRESULT WINAPI RegSaveRestoreW (HWND hWnd, LPCWSTR pszTitleString, HKEY hkBackupKey, LPCWSTR pcszRootKey, LPCWSTR pcszSubKey, LPCWSTR pcszValueName, DWORD dwFlags)
 
HRESULT WINAPI RegSaveRestoreOnINFA (HWND hWnd, LPCSTR pszTitle, LPCSTR pszINF, LPCSTR pszSection, HKEY hHKLMBackKey, HKEY hHKCUBackKey, DWORD dwFlags)
 
HRESULT WINAPI RegSaveRestoreOnINFW (HWND hWnd, LPCWSTR pszTitle, LPCWSTR pszINF, LPCWSTR pszSection, HKEY hHKLMBackKey, HKEY hHKCUBackKey, DWORD dwFlags)
 

Function Documentation

◆ create_tmp_ini_file()

static BOOL create_tmp_ini_file ( HMODULE  hm,
WCHAR ini_file 
)
static

Definition at line 46 of file reg.c.

47{
48 HRSRC hrsrc;
49 HGLOBAL hmem = NULL;
50 DWORD rsrc_size, bytes_written;
51 VOID *rsrc_data;
53
54 if(!get_temp_ini_path(ini_file)) {
55 ERR("Can't get temp ini file path\n");
56 goto error;
57 }
58
59 if (!(hrsrc = FindResourceW(hm, L"REGINST", L"REGINST"))) {
60 ERR("Can't find REGINST resource\n");
61 goto error;
62 }
63
64 rsrc_size = SizeofResource(hm, hrsrc);
65 hmem = LoadResource(hm, hrsrc);
66 rsrc_data = LockResource(hmem);
67
68 if(!rsrc_data || !rsrc_size) {
69 ERR("Can't load REGINST resource\n");
70 goto error;
71 }
72
73 if((hf = CreateFileW(ini_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
75 ERR("Unable to create temp ini file\n");
76 goto error;
77 }
78 if(!WriteFile(hf, rsrc_data, rsrc_size, &bytes_written, NULL) || rsrc_size != bytes_written) {
79 ERR("Write failed\n");
80 goto error;
81 }
82 FreeResource(hmem);
83 CloseHandle(hf);
84 return TRUE;
85error:
86 if(hmem) FreeResource(hmem);
88 return FALSE;
89}
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL get_temp_ini_path(LPWSTR name)
Definition: reg.c:34
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
#define error(str)
Definition: mkdosfs.c:1605
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90

Referenced by RegInstallW().

◆ free_strtable()

static void free_strtable ( STRTABLEW wtable)
static

Definition at line 120 of file reg.c.

121{
122 DWORD j;
123
124 for (j = 0; j < wtable->cEntries; j++)
125 {
126 free(wtable->pse[j].pszName);
127 free(wtable->pse[j].pszValue);
128 }
129
130 free(wtable->pse);
131 free(wtable);
132}
#define free
Definition: debug_ros.c:5
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
LPWSTR pszValue
Definition: advpub.h:89
LPWSTR pszName
Definition: advpub.h:88
DWORD cEntries
Definition: advpub.h:104
STRENTRYW * pse
Definition: advpub.h:105

Referenced by RegInstallA().

◆ get_temp_ini_path()

static BOOL get_temp_ini_path ( LPWSTR  name)
static

Definition at line 34 of file reg.c.

35{
36 WCHAR tmp_dir[MAX_PATH];
37
38 if(!GetTempPathW(ARRAY_SIZE(tmp_dir), tmp_dir))
39 return FALSE;
40
41 if (!GetTempFileNameW(tmp_dir, L"avp", 0, name))
42 return FALSE;
43 return TRUE;
44}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
short WCHAR
Definition: pedump.c:58
Definition: name.c:39

Referenced by create_tmp_ini_file().

◆ RegInstallA()

HRESULT WINAPI RegInstallA ( HMODULE  hm,
LPCSTR  pszSection,
const STRTABLEA pstTable 
)

Definition at line 139 of file reg.c.

140{
142 STRTABLEW *wtable;
143 HRESULT hr;
144
145 TRACE("(%p, %s, %p)\n", hm, debugstr_a(pszSection), pstTable);
146
147 if (pstTable)
148 wtable = strtable_atow(pstTable);
149 else
150 wtable = NULL;
151
153
154 hr = RegInstallW(hm, section.Buffer, wtable);
155
156 if (pstTable)
157 free_strtable(wtable);
158
160
161 return hr;
162}
HRESULT hr
Definition: delayimp.cpp:582
HRESULT WINAPI RegInstallW(HMODULE hm, LPCWSTR pszSection, const STRTABLEW *pstTable)
Definition: reg.c:212
static void free_strtable(STRTABLEW *wtable)
Definition: reg.c:120
static STRTABLEW * strtable_atow(const STRTABLEA *atable)
Definition: reg.c:105
#define debugstr_a
Definition: kernel32.h:31
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parser.c:56

Referenced by register_iexplore().

◆ RegInstallW()

HRESULT WINAPI RegInstallW ( HMODULE  hm,
LPCWSTR  pszSection,
const STRTABLEW pstTable 
)

Definition at line 212 of file reg.c.

213{
214 unsigned int i;
215 CABINFOW cabinfo;
216 WCHAR tmp_ini_path[MAX_PATH];
217 HRESULT hr = E_FAIL;
218
219 TRACE("(%p, %s, %p)\n", hm, debugstr_w(pszSection), pstTable);
220
221 if(!create_tmp_ini_file(hm, tmp_ini_path))
222 return E_FAIL;
223
224 if (write_predefined_strings(hm, tmp_ini_path) != S_OK)
225 goto done;
226
227 /* Write the additional string table */
228 if (pstTable)
229 {
230 for(i = 0; i < pstTable->cEntries; i++)
231 {
232 WCHAR tmp_value[MAX_PATH + 2];
233
234 tmp_value[0] = '\"';
235 lstrcpyW(tmp_value + 1, pstTable->pse[i].pszValue);
236 lstrcatW(tmp_value, L"\"");
237
238 WritePrivateProfileStringW(L"Strings", pstTable->pse[i].pszName, tmp_value, tmp_ini_path);
239 }
240 }
241
242 /* flush cache */
243 WritePrivateProfileStringW(NULL, NULL, NULL, tmp_ini_path);
244
245 /* FIXME: read AdvOptions val for dwFlags */
246 ZeroMemory(&cabinfo, sizeof(CABINFOW));
247 cabinfo.pszInf = tmp_ini_path;
248 cabinfo.pszSection = (LPWSTR)pszSection;
249 cabinfo.dwFlags = 0;
250
251 hr = ExecuteCabW(NULL, &cabinfo, NULL);
252
253done:
254
255 DeleteFileW(tmp_ini_path);
256
257 return hr;
258}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW *pCab, LPVOID pReserved)
Definition: install.c:622
static HRESULT write_predefined_strings(HMODULE hm, LPCWSTR ini_path)
Definition: reg.c:164
static BOOL create_tmp_ini_file(HMODULE hm, WCHAR *ini_file)
Definition: reg.c:46
#define lstrcpyW
Definition: compat.h:749
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define ZeroMemory
Definition: minwinbase.h:31
LPWSTR pszSection
Definition: advpub.h:45
LPWSTR pszInf
Definition: advpub.h:44
DWORD dwFlags
Definition: advpub.h:47
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by RegInstallA().

◆ RegRestoreAllA()

HRESULT WINAPI RegRestoreAllA ( HWND  hWnd,
LPSTR  pszTitleString,
HKEY  hkBackupKey 
)

Definition at line 265 of file reg.c.

266{
268 HRESULT hr;
269
270 TRACE("(%p, %s, %p)\n", hWnd, debugstr_a(pszTitleString), hkBackupKey);
271
272 RtlCreateUnicodeStringFromAsciiz(&title, pszTitleString);
273
274 hr = RegRestoreAllW(hWnd, title.Buffer, hkBackupKey);
275
277
278 return hr;
279}
HWND hWnd
Definition: settings.c:17
HRESULT WINAPI RegRestoreAllW(HWND hWnd, LPWSTR pszTitleString, HKEY hkBackupKey)
Definition: reg.c:298
static char title[]
Definition: ps.c:92

◆ RegRestoreAllW()

HRESULT WINAPI RegRestoreAllW ( HWND  hWnd,
LPWSTR  pszTitleString,
HKEY  hkBackupKey 
)

Definition at line 298 of file reg.c.

299{
300 FIXME("(%p, %s, %p) stub\n", hWnd, debugstr_w(pszTitleString), hkBackupKey);
301
302 return E_FAIL;
303}
#define FIXME(fmt,...)
Definition: precomp.h:53

Referenced by RegRestoreAllA().

◆ RegSaveRestoreA()

HRESULT WINAPI RegSaveRestoreA ( HWND  hWnd,
LPCSTR  pszTitleString,
HKEY  hkBackupKey,
LPCSTR  pcszRootKey,
LPCSTR  pcszSubKey,
LPCSTR  pcszValueName,
DWORD  dwFlags 
)

Definition at line 310 of file reg.c.

313{
314 UNICODE_STRING title, root, subkey, value;
315 HRESULT hr;
316
317 TRACE("(%p, %s, %p, %s, %s, %s, %ld)\n", hWnd, debugstr_a(pszTitleString),
318 hkBackupKey, debugstr_a(pcszRootKey), debugstr_a(pcszSubKey),
319 debugstr_a(pcszValueName), dwFlags);
320
321 RtlCreateUnicodeStringFromAsciiz(&title, pszTitleString);
323 RtlCreateUnicodeStringFromAsciiz(&subkey, pcszSubKey);
325
326 hr = RegSaveRestoreW(hWnd, title.Buffer, hkBackupKey, root.Buffer,
327 subkey.Buffer, value.Buffer, dwFlags);
328
331 RtlFreeUnicodeString(&subkey);
333
334 return hr;
335}
struct _root root
HRESULT WINAPI RegSaveRestoreW(HWND hWnd, LPCWSTR pszTitleString, HKEY hkBackupKey, LPCWSTR pcszRootKey, LPCWSTR pcszSubKey, LPCWSTR pcszValueName, DWORD dwFlags)
Definition: reg.c:358
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
Definition: pdh_main.c:96

◆ RegSaveRestoreOnINFA()

HRESULT WINAPI RegSaveRestoreOnINFA ( HWND  hWnd,
LPCSTR  pszTitle,
LPCSTR  pszINF,
LPCSTR  pszSection,
HKEY  hHKLMBackKey,
HKEY  hHKCUBackKey,
DWORD  dwFlags 
)

Definition at line 374 of file reg.c.

377{
379 HRESULT hr;
380
381 TRACE("(%p, %s, %s, %s, %p, %p, %ld)\n", hWnd, debugstr_a(pszTitle),
382 debugstr_a(pszINF), debugstr_a(pszSection),
383 hHKLMBackKey, hHKCUBackKey, dwFlags);
384
388
389 hr = RegSaveRestoreOnINFW(hWnd, title.Buffer, inf.Buffer, section.Buffer,
390 hHKLMBackKey, hHKCUBackKey, dwFlags);
391
395
396 return hr;
397}
HRESULT WINAPI RegSaveRestoreOnINFW(HWND hWnd, LPCWSTR pszTitle, LPCWSTR pszINF, LPCWSTR pszSection, HKEY hHKLMBackKey, HKEY hHKCUBackKey, DWORD dwFlags)
Definition: reg.c:420

◆ RegSaveRestoreOnINFW()

HRESULT WINAPI RegSaveRestoreOnINFW ( HWND  hWnd,
LPCWSTR  pszTitle,
LPCWSTR  pszINF,
LPCWSTR  pszSection,
HKEY  hHKLMBackKey,
HKEY  hHKCUBackKey,
DWORD  dwFlags 
)

Definition at line 420 of file reg.c.

423{
424 FIXME("(%p, %s, %s, %s, %p, %p, %ld): stub\n", hWnd, debugstr_w(pszTitle),
425 debugstr_w(pszINF), debugstr_w(pszSection),
426 hHKLMBackKey, hHKCUBackKey, dwFlags);
427
428 return E_FAIL;
429}

Referenced by RegSaveRestoreOnINFA().

◆ RegSaveRestoreW()

HRESULT WINAPI RegSaveRestoreW ( HWND  hWnd,
LPCWSTR  pszTitleString,
HKEY  hkBackupKey,
LPCWSTR  pcszRootKey,
LPCWSTR  pcszSubKey,
LPCWSTR  pcszValueName,
DWORD  dwFlags 
)

Definition at line 358 of file reg.c.

361{
362 FIXME("(%p, %s, %p, %s, %s, %s, %ld): stub\n", hWnd, debugstr_w(pszTitleString),
363 hkBackupKey, debugstr_w(pcszRootKey), debugstr_w(pcszSubKey),
364 debugstr_w(pcszValueName), dwFlags);
365
366 return E_FAIL;
367}

Referenced by RegSaveRestoreA().

◆ strentry_atow()

static void strentry_atow ( const STRENTRYA aentry,
STRENTRYW wentry 
)
static

Definition at line 91 of file reg.c.

92{
93 DWORD name_len, val_len;
94
95 name_len = MultiByteToWideChar(CP_ACP, 0, aentry->pszName, -1, NULL, 0);
96 val_len = MultiByteToWideChar(CP_ACP, 0, aentry->pszValue, -1, NULL, 0);
97
98 wentry->pszName = malloc(name_len * sizeof(WCHAR));
99 wentry->pszValue = malloc(val_len * sizeof(WCHAR));
100
101 MultiByteToWideChar(CP_ACP, 0, aentry->pszName, -1, wentry->pszName, name_len);
102 MultiByteToWideChar(CP_ACP, 0, aentry->pszValue, -1, wentry->pszValue, val_len);
103}
#define malloc
Definition: debug_ros.c:4
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
LPSTR pszName
Definition: advpub.h:82
LPSTR pszValue
Definition: advpub.h:83

Referenced by strtable_atow().

◆ strtable_atow()

static STRTABLEW * strtable_atow ( const STRTABLEA atable)
static

Definition at line 105 of file reg.c.

106{
107 STRTABLEW *wtable;
108 DWORD j;
109
110 wtable = malloc(sizeof(STRTABLEW));
111 wtable->pse = malloc(atable->cEntries * sizeof(STRENTRYW));
112 wtable->cEntries = atable->cEntries;
113
114 for (j = 0; j < wtable->cEntries; j++)
115 strentry_atow(&atable->pse[j], &wtable->pse[j]);
116
117 return wtable;
118}
static void strentry_atow(const STRENTRYA *aentry, STRENTRYW *wentry)
Definition: reg.c:91
DWORD cEntries
Definition: advpub.h:97
STRENTRYA * pse
Definition: advpub.h:98

Referenced by RegInstallA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( advpack  )

◆ write_predefined_strings()

static HRESULT write_predefined_strings ( HMODULE  hm,
LPCWSTR  ini_path 
)
static

Definition at line 164 of file reg.c.

165{
166 WCHAR mod_path[MAX_PATH + 2];
167 WCHAR sys_mod_path[MAX_PATH + 2];
168 WCHAR sys_root[MAX_PATH];
169
170 *mod_path = '\"';
171 if (!GetModuleFileNameW(hm, mod_path + 1, ARRAY_SIZE(mod_path) - 2))
172 return E_FAIL;
173
174 lstrcatW(mod_path, L"\"");
175 WritePrivateProfileStringW(L"Strings", L"_MOD_PATH", mod_path, ini_path);
176
177 *sys_root = '\0';
178 GetEnvironmentVariableW(L"SystemRoot", sys_root, ARRAY_SIZE(sys_root));
179
180 if(!wcsnicmp(sys_root, mod_path + 1, lstrlenW(sys_root)))
181 {
182 *sys_mod_path = '\"';
183 lstrcpyW(sys_mod_path + 1, L"%SystemRoot%");
184 lstrcatW(sys_mod_path, mod_path + 1 + lstrlenW(sys_root));
185 }
186 else
187 {
188 FIXME("SYS_MOD_PATH needs more work\n");
189 lstrcpyW(sys_mod_path, mod_path);
190 }
191
192 WritePrivateProfileStringW(L"Strings", L"_SYS_MOD_PATH", sys_mod_path, ini_path);
193
194 return S_OK;
195}
#define wcsnicmp
Definition: compat.h:14
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600

Referenced by RegInstallW().