ReactOS  0.4.14-dev-608-gd495a4f
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)
 

Variables

static const WCHAR REGINST [] = {'R','E','G','I','N','S','T',0}
 
static const WCHAR Strings [] = {'S','t','r','i','n','g','s',0}
 
static const WCHAR MOD_PATH [] = {'_','M','O','D','_','P','A','T','H',0}
 
static const WCHAR SYS_MOD_PATH [] = {'_','S','Y','S','_','M','O','D','_','P','A','T','H',0}
 
static const WCHAR SystemRoot [] = {'S','y','s','t','e','m','R','o','o','t',0}
 
static const WCHAR escaped_SystemRoot [] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}
 
static const WCHAR quote [] = {'\"',0}
 

Function Documentation

◆ create_tmp_ini_file()

static BOOL create_tmp_ini_file ( HMODULE  hm,
WCHAR ini_file 
)
static

Definition at line 55 of file reg.c.

56 {
57  HRSRC hrsrc;
58  HGLOBAL hmem = NULL;
59  DWORD rsrc_size, bytes_written;
60  VOID *rsrc_data;
62 
63  if(!get_temp_ini_path(ini_file)) {
64  ERR("Can't get temp ini file path\n");
65  goto error;
66  }
67 
68  if(!(hrsrc = FindResourceW(hm, REGINST, REGINST))) {
69  ERR("Can't find REGINST resource\n");
70  goto error;
71  }
72 
73  rsrc_size = SizeofResource(hm, hrsrc);
74  hmem = LoadResource(hm, hrsrc);
75  rsrc_data = LockResource(hmem);
76 
77  if(!rsrc_data || !rsrc_size) {
78  ERR("Can't load REGINST resource\n");
79  goto error;
80  }
81 
82  if((hf = CreateFileW(ini_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
84  ERR("Unable to create temp ini file\n");
85  goto error;
86  }
87  if(!WriteFile(hf, rsrc_data, rsrc_size, &bytes_written, NULL) || rsrc_size != bytes_written) {
88  ERR("Write failed\n");
89  goto error;
90  }
91  FreeResource(hmem);
92  CloseHandle(hf);
93  return TRUE;
94 error:
95  if(hmem) FreeResource(hmem);
96  if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf);
97  return FALSE;
98 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
#define error(str)
Definition: mkdosfs.c:1605
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static BOOL get_temp_ini_path(LPWSTR name)
Definition: reg.c:42
static const WCHAR REGINST[]
Definition: reg.c:34
#define ERR(fmt,...)
Definition: debug.h:109
#define CREATE_ALWAYS
Definition: disk.h:72
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define CreateFileW
Definition: compat.h:408

Referenced by RegInstallW().

◆ free_strtable()

static void free_strtable ( STRTABLEW wtable)
static

Definition at line 129 of file reg.c.

130 {
131  DWORD j;
132 
133  for (j = 0; j < wtable->cEntries; j++)
134  {
135  HeapFree(GetProcessHeap(), 0, wtable->pse[j].pszName);
136  HeapFree(GetProcessHeap(), 0, wtable->pse[j].pszValue);
137  }
138 
139  HeapFree(GetProcessHeap(), 0, wtable->pse);
140  HeapFree(GetProcessHeap(), 0, wtable);
141 }
DWORD cEntries
Definition: advpub.h:104
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
#define GetProcessHeap()
Definition: compat.h:403
LPWSTR pszValue
Definition: advpub.h:89
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR pszName
Definition: advpub.h:88
STRENTRYW * pse
Definition: advpub.h:105
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RegInstallA().

◆ get_temp_ini_path()

static BOOL get_temp_ini_path ( LPWSTR  name)
static

Definition at line 42 of file reg.c.

43 {
44  static const WCHAR prefix[] = {'a','v','p',0};
45  WCHAR tmp_dir[MAX_PATH];
46 
47  if(!GetTempPathW(ARRAY_SIZE(tmp_dir), tmp_dir))
48  return FALSE;
49 
50  if(!GetTempFileNameW(tmp_dir, prefix, 0, name))
51  return FALSE;
52  return TRUE;
53 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38

Referenced by create_tmp_ini_file().

◆ RegInstallA()

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

Definition at line 148 of file reg.c.

149 {
151  STRTABLEW *wtable;
152  HRESULT hr;
153 
154  TRACE("(%p, %s, %p)\n", hm, debugstr_a(pszSection), pstTable);
155 
156  if (pstTable)
157  wtable = strtable_atow(pstTable);
158  else
159  wtable = NULL;
160 
162 
163  hr = RegInstallW(hm, section.Buffer, wtable);
164 
165  if (pstTable)
166  free_strtable(wtable);
167 
169 
170  return hr;
171 }
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:55
static IMAGE_SECTION_HEADER section
Definition: loader.c:152
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
static void free_strtable(STRTABLEW *wtable)
Definition: reg.c:129
static STRTABLEW * strtable_atow(const STRTABLEA *atable)
Definition: reg.c:114
HRESULT WINAPI RegInstallW(HMODULE hm, LPCWSTR pszSection, const STRTABLEW *pstTable)
Definition: reg.c:221

Referenced by register_iexplore().

◆ RegInstallW()

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

Definition at line 221 of file reg.c.

222 {
223  unsigned int i;
224  CABINFOW cabinfo;
225  WCHAR tmp_ini_path[MAX_PATH];
226  HRESULT hr = E_FAIL;
227 
228  TRACE("(%p, %s, %p)\n", hm, debugstr_w(pszSection), pstTable);
229 
230  if(!create_tmp_ini_file(hm, tmp_ini_path))
231  return E_FAIL;
232 
233  if (write_predefined_strings(hm, tmp_ini_path) != S_OK)
234  goto done;
235 
236  /* Write the additional string table */
237  if (pstTable)
238  {
239  for(i = 0; i < pstTable->cEntries; i++)
240  {
241  WCHAR tmp_value[MAX_PATH + 2];
242 
243  tmp_value[0] = '\"';
244  lstrcpyW(tmp_value + 1, pstTable->pse[i].pszValue);
245  lstrcatW(tmp_value, quote);
246 
247  WritePrivateProfileStringW(Strings, pstTable->pse[i].pszName, tmp_value, tmp_ini_path);
248  }
249  }
250 
251  /* flush cache */
252  WritePrivateProfileStringW(NULL, NULL, NULL, tmp_ini_path);
253 
254  /* FIXME: read AdvOptions val for dwFlags */
255  ZeroMemory(&cabinfo, sizeof(CABINFOW));
256  cabinfo.pszInf = tmp_ini_path;
257  cabinfo.pszSection = (LPWSTR)pszSection;
258  cabinfo.dwFlags = 0;
259 
260  hr = ExecuteCabW(NULL, &cabinfo, NULL);
261 
262 done:
263 
264  DeleteFileW(tmp_ini_path);
265 
266  return hr;
267 }
HRESULT hr
Definition: shlfolder.c:183
LPWSTR pszInf
Definition: advpub.h:44
DWORD cEntries
Definition: advpub.h:104
#define ZeroMemory
Definition: winbase.h:1642
HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW *pCab, LPVOID pReserved)
Definition: install.c:671
#define E_FAIL
Definition: ddrawi.h:102
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 debugstr_w
Definition: kernel32.h:32
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
DWORD dwFlags
Definition: advpub.h:47
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR quote[]
Definition: reg.c:40
LONG HRESULT
Definition: typedefs.h:77
LPWSTR pszValue
Definition: advpub.h:89
#define MAX_PATH
Definition: compat.h:26
static const WCHAR Strings[]
Definition: reg.c:35
static BOOL create_tmp_ini_file(HMODULE hm, WCHAR *ini_file)
Definition: reg.c:55
LPWSTR pszName
Definition: advpub.h:88
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
STRENTRYW * pse
Definition: advpub.h:105
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static HRESULT write_predefined_strings(HMODULE hm, LPCWSTR ini_path)
Definition: reg.c:173
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR pszSection
Definition: advpub.h:45

Referenced by RegInstallA().

◆ RegRestoreAllA()

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

Definition at line 274 of file reg.c.

275 {
277  HRESULT hr;
278 
279  TRACE("(%p, %s, %p)\n", hWnd, debugstr_a(pszTitleString), hkBackupKey);
280 
281  RtlCreateUnicodeStringFromAsciiz(&title, pszTitleString);
282 
283  hr = RegRestoreAllW(hWnd, title.Buffer, hkBackupKey);
284 
286 
287  return hr;
288 }
HRESULT hr
Definition: shlfolder.c:183
HWND hWnd
Definition: settings.c:17
HRESULT WINAPI RegRestoreAllW(HWND hWnd, LPWSTR pszTitleString, HKEY hkBackupKey)
Definition: reg.c:307
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
static char title[]
Definition: ps.c:92

◆ RegRestoreAllW()

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

Definition at line 307 of file reg.c.

308 {
309  FIXME("(%p, %s, %p) stub\n", hWnd, debugstr_w(pszTitleString), hkBackupKey);
310 
311  return E_FAIL;
312 }
HWND hWnd
Definition: settings.c:17
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

Referenced by RegRestoreAllA().

◆ RegSaveRestoreA()

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

Definition at line 319 of file reg.c.

322 {
323  UNICODE_STRING title, root, subkey, value;
324  HRESULT hr;
325 
326  TRACE("(%p, %s, %p, %s, %s, %s, %d)\n", hWnd, debugstr_a(pszTitleString),
327  hkBackupKey, debugstr_a(pcszRootKey), debugstr_a(pcszSubKey),
328  debugstr_a(pcszValueName), dwFlags);
329 
330  RtlCreateUnicodeStringFromAsciiz(&title, pszTitleString);
331  RtlCreateUnicodeStringFromAsciiz(&root, pcszRootKey);
332  RtlCreateUnicodeStringFromAsciiz(&subkey, pcszSubKey);
333  RtlCreateUnicodeStringFromAsciiz(&value, pcszValueName);
334 
335  hr = RegSaveRestoreW(hWnd, title.Buffer, hkBackupKey, root.Buffer,
336  subkey.Buffer, value.Buffer, dwFlags);
337 
340  RtlFreeUnicodeString(&subkey);
342 
343  return hr;
344 }
HRESULT hr
Definition: shlfolder.c:183
struct _root root
HWND hWnd
Definition: settings.c:17
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLsizei const GLfloat * value
Definition: glext.h:6069
HRESULT WINAPI RegSaveRestoreW(HWND hWnd, LPCWSTR pszTitleString, HKEY hkBackupKey, LPCWSTR pcszRootKey, LPCWSTR pcszSubKey, LPCWSTR pcszValueName, DWORD dwFlags)
Definition: reg.c:367
static char title[]
Definition: ps.c:92

◆ RegSaveRestoreOnINFA()

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

Definition at line 383 of file reg.c.

386 {
388  HRESULT hr;
389 
390  TRACE("(%p, %s, %s, %s, %p, %p, %d)\n", hWnd, debugstr_a(pszTitle),
391  debugstr_a(pszINF), debugstr_a(pszSection),
392  hHKLMBackKey, hHKCUBackKey, dwFlags);
393 
395  RtlCreateUnicodeStringFromAsciiz(&inf, pszINF);
397 
398  hr = RegSaveRestoreOnINFW(hWnd, title.Buffer, inf.Buffer, section.Buffer,
399  hHKLMBackKey, hHKCUBackKey, dwFlags);
400 
402  RtlFreeUnicodeString(&inf);
404 
405  return hr;
406 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI RegSaveRestoreOnINFW(HWND hWnd, LPCWSTR pszTitle, LPCWSTR pszINF, LPCWSTR pszSection, HKEY hHKLMBackKey, HKEY hHKCUBackKey, DWORD dwFlags)
Definition: reg.c:429
HWND hWnd
Definition: settings.c:17
Definition: parser.c:55
static IMAGE_SECTION_HEADER section
Definition: loader.c:152
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static char title[]
Definition: ps.c:92

◆ RegSaveRestoreOnINFW()

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

Definition at line 429 of file reg.c.

432 {
433  FIXME("(%p, %s, %s, %s, %p, %p, %d): stub\n", hWnd, debugstr_w(pszTitle),
434  debugstr_w(pszINF), debugstr_w(pszSection),
435  hHKLMBackKey, hHKCUBackKey, dwFlags);
436 
437  return E_FAIL;
438 }
HWND hWnd
Definition: settings.c:17
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by RegSaveRestoreOnINFA().

◆ RegSaveRestoreW()

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

Definition at line 367 of file reg.c.

370 {
371  FIXME("(%p, %s, %p, %s, %s, %s, %d): stub\n", hWnd, debugstr_w(pszTitleString),
372  hkBackupKey, debugstr_w(pcszRootKey), debugstr_w(pcszSubKey),
373  debugstr_w(pcszValueName), dwFlags);
374 
375  return E_FAIL;
376 }
HWND hWnd
Definition: settings.c:17
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by RegSaveRestoreA().

◆ strentry_atow()

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

Definition at line 100 of file reg.c.

101 {
102  DWORD name_len, val_len;
103 
104  name_len = MultiByteToWideChar(CP_ACP, 0, aentry->pszName, -1, NULL, 0);
105  val_len = MultiByteToWideChar(CP_ACP, 0, aentry->pszValue, -1, NULL, 0);
106 
107  wentry->pszName = HeapAlloc(GetProcessHeap(), 0, name_len * sizeof(WCHAR));
108  wentry->pszValue = HeapAlloc(GetProcessHeap(), 0, val_len * sizeof(WCHAR));
109 
110  MultiByteToWideChar(CP_ACP, 0, aentry->pszName, -1, wentry->pszName, name_len);
111  MultiByteToWideChar(CP_ACP, 0, aentry->pszValue, -1, wentry->pszValue, val_len);
112 }
#define CP_ACP
Definition: compat.h:99
LPSTR pszValue
Definition: advpub.h:83
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszValue
Definition: advpub.h:89
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR pszName
Definition: advpub.h:88
LPSTR pszName
Definition: advpub.h:82
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by strtable_atow().

◆ strtable_atow()

static STRTABLEW* strtable_atow ( const STRTABLEA atable)
static

Definition at line 114 of file reg.c.

115 {
116  STRTABLEW *wtable;
117  DWORD j;
118 
119  wtable = HeapAlloc(GetProcessHeap(), 0, sizeof(STRTABLEW));
120  wtable->pse = HeapAlloc(GetProcessHeap(), 0, atable->cEntries * sizeof(STRENTRYW));
121  wtable->cEntries = atable->cEntries;
122 
123  for (j = 0; j < wtable->cEntries; j++)
124  strentry_atow(&atable->pse[j], &wtable->pse[j]);
125 
126  return wtable;
127 }
DWORD cEntries
Definition: advpub.h:97
DWORD cEntries
Definition: advpub.h:104
STRENTRYA * pse
Definition: advpub.h:98
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
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static void strentry_atow(const STRENTRYA *aentry, STRENTRYW *wentry)
Definition: reg.c:100
unsigned long DWORD
Definition: ntddk_ex.h:95
STRENTRYW * pse
Definition: advpub.h:105

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 173 of file reg.c.

174 {
175  WCHAR mod_path[MAX_PATH + 2];
176  WCHAR sys_mod_path[MAX_PATH + 2];
177  WCHAR sys_root[MAX_PATH];
178 
179  *mod_path = '\"';
180  if (!GetModuleFileNameW(hm, mod_path + 1, ARRAY_SIZE(mod_path) - 2))
181  return E_FAIL;
182 
183  lstrcatW(mod_path, quote);
184  WritePrivateProfileStringW(Strings, MOD_PATH, mod_path, ini_path);
185 
186  *sys_root = '\0';
187  GetEnvironmentVariableW(SystemRoot, sys_root, ARRAY_SIZE(sys_root));
188 
189  if(!_wcsnicmp(sys_root, mod_path + 1, lstrlenW(sys_root)))
190  {
191  *sys_mod_path = '\"';
192  lstrcpyW(sys_mod_path + 1, escaped_SystemRoot);
193  lstrcatW(sys_mod_path, mod_path + 1 + lstrlenW(sys_root));
194  }
195  else
196  {
197  FIXME("SYS_MOD_PATH needs more work\n");
198  lstrcpyW(sys_mod_path, mod_path);
199  }
200 
201  WritePrivateProfileStringW(Strings, SYS_MOD_PATH, sys_mod_path, ini_path);
202 
203  return S_OK;
204 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
static const WCHAR SYS_MOD_PATH[]
Definition: reg.c:37
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
static const WCHAR SystemRoot[]
Definition: reg.c:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR quote[]
Definition: reg.c:40
#define MAX_PATH
Definition: compat.h:26
static const WCHAR Strings[]
Definition: reg.c:35
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR escaped_SystemRoot[]
Definition: reg.c:39
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:420
static const WCHAR MOD_PATH[]
Definition: reg.c:36

Referenced by RegInstallW().

Variable Documentation

◆ escaped_SystemRoot

const WCHAR escaped_SystemRoot[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}
static

Definition at line 39 of file reg.c.

Referenced by write_predefined_strings().

◆ MOD_PATH

const WCHAR MOD_PATH[] = {'_','M','O','D','_','P','A','T','H',0}
static

Definition at line 36 of file reg.c.

Referenced by write_predefined_strings().

◆ quote

const WCHAR quote[] = {'\"',0}
static

Definition at line 40 of file reg.c.

Referenced by RegInstallW(), and write_predefined_strings().

◆ REGINST

const WCHAR REGINST[] = {'R','E','G','I','N','S','T',0}
static

Definition at line 34 of file reg.c.

Referenced by create_tmp_ini_file().

◆ Strings

◆ SYS_MOD_PATH

const WCHAR SYS_MOD_PATH[] = {'_','S','Y','S','_','M','O','D','_','P','A','T','H',0}
static

Definition at line 37 of file reg.c.

Referenced by write_predefined_strings().

◆ SystemRoot