ReactOS  0.4.15-dev-344-g6808e40
startup.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002 Andreas Mohr
3  * Copyright (C) 2002 Shachar Shemesh
4  * Copyright (C) 2013 Edijs Kolesnikovics
5  * Copyright (C) 2018 Katayama Hirofumi MZ
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /* Based on the Wine "bootup" handler application
23  *
24  * This app handles the various "hooks" windows allows for applications to perform
25  * as part of the bootstrap process. Theses are roughly devided into three types.
26  * Knowledge base articles that explain this are 137367, 179365, 232487 and 232509.
27  * Also, 119941 has some info on grpconv.exe
28  * The operations performed are (by order of execution):
29  *
30  * After log in
31  * - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx (synch, no imp)
32  * - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce (synch)
33  * - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run (asynch)
34  * - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run (asynch)
35  * - All users Startup folder "%ALLUSERSPROFILE%\Start Menu\Programs\Startup" (asynch, no imp)
36  * - Current user Startup folder "%USERPROFILE%\Start Menu\Programs\Startup" (asynch, no imp)
37  * - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce (asynch)
38  *
39  * None is processed in Safe Mode // FIXME: Check RunOnceEx in Safe Mode
40  */
41 
42 #include "precomp.h"
43 
44 // For the auto startup process
46 
47 #define INVALID_RUNCMD_RETURN -1
48 
60 static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
61 {
62  STARTUPINFOW si;
64  DWORD exit_code = 0;
65  WCHAR szCmdLineExp[MAX_PATH+1] = L"\0";
66 
67  ExpandEnvironmentStringsW(cmdline, szCmdLineExp, _countof(szCmdLineExp));
68 
69  memset(&si, 0, sizeof(si));
70  si.cb = sizeof(si);
71  if (minimized)
72  {
75  }
76  memset(&info, 0, sizeof(info));
77 
78  if (!CreateProcessW(NULL, szCmdLineExp, NULL, NULL, FALSE, 0, NULL, dir, &si, &info))
79  {
80  TRACE("Failed to run command (%lu)\n", GetLastError());
81 
82  return INVALID_RUNCMD_RETURN;
83  }
84 
85  TRACE("Successfully ran command\n");
86 
87  if (wait)
88  {
89  HANDLE Handles[] = { info.hProcess };
90  DWORD nCount = _countof(Handles);
91  DWORD dwWait;
92  MSG msg;
93 
94  /* wait for the process to exit */
95  for (;;)
96  {
97  /* We need to keep processing messages,
98  otherwise we will hang anything that is trying to send a message to us */
99  dwWait = MsgWaitForMultipleObjects(nCount, Handles, FALSE, INFINITE, QS_ALLINPUT);
100 
101  /* WAIT_OBJECT_0 + nCount signals an event in the message queue,
102  so anything other than that means we are done. */
103  if (dwWait != WAIT_OBJECT_0 + nCount)
104  {
105  if (dwWait >= WAIT_OBJECT_0 && dwWait < WAIT_OBJECT_0 + nCount)
106  TRACE("Event %u signaled\n", dwWait - WAIT_OBJECT_0);
107  else
108  WARN("Return code: %u\n", dwWait);
109  break;
110  }
111 
112  while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
113  {
116  }
117  }
118 
119  GetExitCodeProcess(info.hProcess, &exit_code);
120  }
121 
122  CloseHandle(info.hThread);
123  CloseHandle(info.hProcess);
124 
125  return exit_code;
126 }
127 
128 
138 static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
139  BOOL bSynchronous)
140 {
141  HKEY hkWin = NULL, hkRun = NULL;
143  DWORD i, cbMaxCmdLine = 0, cchMaxValue = 0;
144  WCHAR *szCmdLine = NULL;
145  WCHAR *szValue = NULL;
146 
147  if (hkRoot == HKEY_LOCAL_MACHINE)
148  TRACE("processing %ls entries under HKLM\n", szKeyName);
149  else
150  TRACE("processing %ls entries under HKCU\n", szKeyName);
151 
152  res = RegOpenKeyExW(hkRoot,
153  L"Software\\Microsoft\\Windows\\CurrentVersion",
154  0,
155  KEY_READ,
156  &hkWin);
157  if (res != ERROR_SUCCESS)
158  {
159  TRACE("RegOpenKeyW failed on Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n", res);
160 
161  goto end;
162  }
163 
164  res = RegOpenKeyExW(hkWin,
165  szKeyName,
166  0,
167  bDelete ? KEY_ALL_ACCESS : KEY_READ,
168  &hkRun);
169  if (res != ERROR_SUCCESS)
170  {
171  if (res == ERROR_FILE_NOT_FOUND)
172  {
173  TRACE("Key doesn't exist - nothing to be done\n");
174 
175  res = ERROR_SUCCESS;
176  }
177  else
178  TRACE("RegOpenKeyExW failed on run key (%ld)\n", res);
179 
180  goto end;
181  }
182 
183  res = RegQueryInfoKeyW(hkRun,
184  NULL,
185  NULL,
186  NULL,
187  NULL,
188  NULL,
189  NULL,
190  &i,
191  &cchMaxValue,
192  &cbMaxCmdLine,
193  NULL,
194  NULL);
195  if (res != ERROR_SUCCESS)
196  {
197  TRACE("Couldn't query key info (%ld)\n", res);
198 
199  goto end;
200  }
201 
202  if (i == 0)
203  {
204  TRACE("No commands to execute.\n");
205 
206  res = ERROR_SUCCESS;
207  goto end;
208  }
209 
210  szCmdLine = (WCHAR*)HeapAlloc(hProcessHeap,
211  0,
212  cbMaxCmdLine);
213  if (szCmdLine == NULL)
214  {
215  TRACE("Couldn't allocate memory for the commands to be executed\n");
216 
218  goto end;
219  }
220 
221  ++cchMaxValue;
222  szValue = (WCHAR*)HeapAlloc(hProcessHeap,
223  0,
224  cchMaxValue * sizeof(*szValue));
225  if (szValue == NULL)
226  {
227  TRACE("Couldn't allocate memory for the value names\n");
228 
230  goto end;
231  }
232 
233  while (i > 0)
234  {
235  DWORD cchValLength = cchMaxValue, cbDataLength = cbMaxCmdLine;
236  DWORD type;
237 
238  --i;
239 
240  res = RegEnumValueW(hkRun,
241  i,
242  szValue,
243  &cchValLength,
244  0,
245  &type,
246  (PBYTE)szCmdLine,
247  &cbDataLength);
248  if (res != ERROR_SUCCESS)
249  {
250  TRACE("Couldn't read in value %lu - %ld\n", i, res);
251 
252  continue;
253  }
254 
255  /* safe mode - force to run if prefixed with asterisk */
256  if (GetSystemMetrics(SM_CLEANBOOT) && (szValue[0] != L'*')) continue;
257 
258  if (bDelete && (res = RegDeleteValueW(hkRun, szValue)) != ERROR_SUCCESS)
259  {
260  TRACE("Couldn't delete value - %lu, %ld. Running command anyways.\n", i, res);
261  }
262 
263  if (type != REG_SZ)
264  {
265  TRACE("Incorrect type of value #%lu (%lu)\n", i, type);
266 
267  continue;
268  }
269 
270  res = runCmd(szCmdLine, NULL, bSynchronous, FALSE);
271  if (res == INVALID_RUNCMD_RETURN)
272  {
273  TRACE("Error running cmd #%lu (%lu)\n", i, GetLastError());
274  }
275 
276  TRACE("Done processing cmd #%lu\n", i);
277  }
278 
279  res = ERROR_SUCCESS;
280 end:
281  if (szValue != NULL)
282  HeapFree(hProcessHeap, 0, szValue);
283  if (szCmdLine != NULL)
284  HeapFree(hProcessHeap, 0, szCmdLine);
285  if (hkRun != NULL)
286  RegCloseKey(hkRun);
287  if (hkWin != NULL)
288  RegCloseKey(hkWin);
289 
290  TRACE("done\n");
291 
292  return res == ERROR_SUCCESS ? TRUE : FALSE;
293 }
294 
295 static BOOL
297 {
298  WCHAR szPath[MAX_PATH] = { 0 };
299  HRESULT hResult;
300  HANDLE hFind;
301  WIN32_FIND_DATAW FoundData;
302  size_t cchPathLen;
303 
304  TRACE("(%d)\n", nCSIDL_Folder);
305 
306  // Get the special folder path
307  hResult = SHGetFolderPathW(NULL, nCSIDL_Folder, NULL, SHGFP_TYPE_CURRENT, szPath);
308  cchPathLen = wcslen(szPath);
309  if (!SUCCEEDED(hResult) || cchPathLen == 0)
310  {
311  WARN("SHGetFolderPath() failed with error %lu\n", GetLastError());
312  return FALSE;
313  }
314 
315  // Build a path with wildcard
316  StringCbCatW(szPath, sizeof(szPath), L"\\*");
317 
318  // Start enumeration of files
319  hFind = FindFirstFileW(szPath, &FoundData);
320  if (hFind == INVALID_HANDLE_VALUE)
321  {
322  WARN("FindFirstFile(%s) failed with error %lu\n", debugstr_w(szPath), GetLastError());
323  return FALSE;
324  }
325 
326  // Enumerate the files
327  do
328  {
329  // Ignore "." and ".."
330  if (wcscmp(FoundData.cFileName, L".") == 0 ||
331  wcscmp(FoundData.cFileName, L"..") == 0)
332  {
333  continue;
334  }
335 
336  // Don't run hidden files
337  if (FoundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
338  continue;
339 
340  // Build the path
341  szPath[cchPathLen + 1] = UNICODE_NULL;
342  StringCbCatW(szPath, sizeof(szPath), FoundData.cFileName);
343 
344  TRACE("Executing %s in directory %s\n", debugstr_w(FoundData.cFileName), debugstr_w(szPath));
345 
346  DWORD dwType;
347  if (GetBinaryTypeW(szPath, &dwType))
348  {
350  }
351  else
352  {
353  SHELLEXECUTEINFOW ExecInfo;
354  ZeroMemory(&ExecInfo, sizeof(ExecInfo));
355  ExecInfo.cbSize = sizeof(ExecInfo);
356  ExecInfo.lpFile = szPath;
357  ShellExecuteExW(&ExecInfo);
358  }
359  } while (FindNextFileW(hFind, &FoundData));
360 
361  FindClose(hFind);
362  return TRUE;
363 }
364 
366 {
367  /* TODO: ProcessRunKeys already checks SM_CLEANBOOT -- items prefixed with * should probably run even in safe mode */
368  BOOL bNormalBoot = GetSystemMetrics(SM_CLEANBOOT) == 0; /* Perform the operations that are performed every boot */
369  /* First, set the current directory to SystemRoot */
370  WCHAR gen_path[MAX_PATH];
371  DWORD res;
372 
373  res = GetWindowsDirectoryW(gen_path, _countof(gen_path));
374  if (res == 0)
375  {
376  TRACE("Couldn't get the windows directory - error %lu\n", GetLastError());
377 
378  return 100;
379  }
380 
381  if (!SetCurrentDirectoryW(gen_path))
382  {
383  TRACE("Cannot set the dir to %ls (%lu)\n", gen_path, GetLastError());
384 
385  return 100;
386  }
387 
388  /* Perform the operations by order checking if policy allows it, checking if this is not Safe Mode,
389  * stopping if one fails, skipping if necessary.
390  */
391  res = TRUE;
392  /* TODO: RunOnceEx */
393 
396 
397  if (res && bNormalBoot && (SHRestricted(REST_NOLOCALMACHINERUN) == 0))
399 
400  if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0))
402 
403  /* All users Startup folder */
405 
406  /* Current user Startup folder */
408 
409  /* TODO: HKCU\RunOnce runs even if StartupHasBeenRun exists */
410  if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0))
412 
413  TRACE("Operation done\n");
414 
415  return res ? 0 : 101;
416 }
417 
419 {
420  if (s_hStartupMutex)
421  {
425  }
426  return TRUE;
427 }
428 
429 BOOL DoStartStartupItems(ITrayWindow *Tray)
430 {
431  DWORD dwWait;
432 
433  if (!bExplorerIsShell)
434  return FALSE;
435 
436  if (!s_hStartupMutex)
437  {
438  // Accidentally, there is possibility that the system starts multiple Explorers
439  // before startup of shell. We use a mutex to match the timing of shell initialization.
440  s_hStartupMutex = CreateMutexW(NULL, FALSE, L"ExplorerIsShellMutex");
441  if (s_hStartupMutex == NULL)
442  return FALSE;
443  }
444 
446  TRACE("dwWait: 0x%08lX\n", dwWait);
447  if (dwWait != WAIT_OBJECT_0)
448  {
449  TRACE("LastError: %ld\n", GetLastError());
450 
452  return FALSE;
453  }
454 
455  const DWORD dwWaitTotal = 3000; // in milliseconds
456  DWORD dwTick = GetTickCount();
457  while (GetShellWindow() == NULL && GetTickCount() - dwTick < dwWaitTotal)
458  {
459  TrayProcessMessages(Tray);
460  }
461 
462  if (GetShellWindow() == NULL)
463  {
465  return FALSE;
466  }
467 
468  // Check the volatile "StartupHasBeenRun" key
469  HKEY hSessionKey, hKey;
470  HRESULT hr = SHCreateSessionKey(KEY_WRITE, &hSessionKey);
471  if (SUCCEEDED(hr))
472  {
473  ASSERT(hSessionKey);
474 
475  DWORD dwDisp;
476  LONG Error = RegCreateKeyExW(hSessionKey, L"StartupHasBeenRun", 0, NULL,
477  REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisp);
478  RegCloseKey(hSessionKey);
479  RegCloseKey(hKey);
480  if (Error == ERROR_SUCCESS && dwDisp == REG_OPENED_EXISTING_KEY)
481  {
482  return FALSE; // Startup programs has already been run
483  }
484  }
485 
486  return TRUE;
487 }
BOOL DoFinishStartupItems(VOID)
Definition: startup.cpp:418
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:407
BOOL bExplorerIsShell
Definition: explorer.cpp:27
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define KEY_READ
Definition: nt_native.h:1023
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
#define HKEY_CURRENT_USER
Definition: winreg.h:11
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WARN(fmt,...)
Definition: debug.h:112
VOID TrayProcessMessages(IN OUT ITrayWindow *Tray)
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define CSIDL_COMMON_STARTUP
Definition: shlobj.h:2035
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
GLuint GLuint end
Definition: gl.h:1545
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1085
TCHAR * cmdline
Definition: stretchblt.cpp:32
INT ProcessStartupItems(VOID)
Definition: startup.cpp:365
static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete, BOOL bSynchronous)
Definition: startup.cpp:138
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1235
int32_t INT
Definition: typedefs.h:57
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL DoStartStartupItems(ITrayWindow *Tray)
Definition: startup.cpp:429
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define UNICODE_NULL
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static BOOL AutoStartupApplications(INT nCSIDL_Folder)
Definition: startup.cpp:296
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
unsigned int dir
Definition: maze.c:112
#define STARTF_USESHOWWINDOW
Definition: winbase.h:472
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4595
static UINT exit_code
Definition: process.c:78
#define SM_CLEANBOOT
Definition: winuser.h:1017
#define KEY_WRITE
Definition: nt_native.h:1031
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey)
Definition: shellreg.c:151
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD cb
Definition: winbase.h:830
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:26
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
#define SW_MINIMIZE
Definition: winuser.h:770
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
static const WCHAR L[]
Definition: oid.c:1250
WORD wShowWindow
Definition: winbase.h:842
#define CSIDL_STARTUP
Definition: shlobj.h:2019
#define INVALID_RUNCMD_RETURN
Definition: startup.cpp:47
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
static HANDLE s_hStartupMutex
Definition: startup.cpp:45
LPCWSTR szPath
Definition: env.c:35
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
#define QS_ALLINPUT
Definition: winuser.h:874
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define msg(x)
Definition: auth_time.c:54
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
DWORD dwFlags
Definition: winbase.h:841
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
Definition: shpolicy.c:836
static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
Definition: startup.cpp:60
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:403
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HANDLE hProcessHeap
Definition: kbswitch.c:25
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502