ReactOS 0.4.15-dev-7674-gc0b4db1
internal.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DYN_FUNCS
 
struct  _DYN_MODULE
 

Typedefs

typedef struct _DYN_FUNCS DYN_FUNCS
 
typedef struct _DYN_FUNCSPDYN_FUNCS
 
typedef struct _DYN_MODULE DYN_MODULE
 
typedef struct _DYN_MODULEPDYN_MODULE
 

Functions

BOOL CopyDirectory (LPCWSTR lpDestinationPath, LPCWSTR lpSourcePath)
 
BOOL CreateDirectoryPath (LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
BOOL RemoveDirectoryPath (LPCWSTR lpPathName)
 
BOOL LoadDynamicImports (PDYN_MODULE Module, PDYN_FUNCS DynFuncs)
 
VOID UnloadDynamicImports (PDYN_FUNCS DynFuncs)
 
LPWSTR AppendBackslash (LPWSTR String)
 
PSECURITY_DESCRIPTOR CreateDefaultSecurityDescriptor (VOID)
 
BOOL AppendSystemPostfix (LPWSTR lpName, DWORD dwMaxLength)
 
BOOL CreateUserHive (LPCWSTR lpKeyName, LPCWSTR lpProfilePath)
 
BOOL UpdateUsersShellFolderSettings (LPCWSTR lpUserProfilePath, HKEY hUserKey)
 
BOOL GetUserSidStringFromToken (HANDLE hToken, PUNICODE_STRING SidString)
 
VOID InitializeGPNotifications (VOID)
 
VOID UninitializeGPNotifications (VOID)
 

Variables

SID_IDENTIFIER_AUTHORITY LocalSystemAuthority
 
SID_IDENTIFIER_AUTHORITY WorldAuthority
 
DYN_MODULE DynOle32
 
HINSTANCE hInstance
 

Typedef Documentation

◆ DYN_FUNCS

◆ DYN_MODULE

◆ PDYN_FUNCS

◆ PDYN_MODULE

Function Documentation

◆ AppendBackslash()

LPWSTR AppendBackslash ( LPWSTR  String)

Definition at line 40 of file misc.c.

41{
43
45 if (String[Length - 1] != L'\\')
46 {
47 String[Length] = L'\\';
48 Length++;
49 String[Length] = (WCHAR)0;
50 }
51
52 return &String[Length];
53}
#define lstrlenW
Definition: compat.h:750
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CopyDirectory().

◆ AppendSystemPostfix()

BOOL AppendSystemPostfix ( LPWSTR  lpName,
DWORD  dwMaxLength 
)

Definition at line 20 of file profile.c.

22{
23 WCHAR szSystemRoot[MAX_PATH];
24 LPWSTR lpszPostfix;
25 LPWSTR lpszPtr;
26
27 /* Build profile name postfix */
28 if (!ExpandEnvironmentStringsW(L"%SystemRoot%",
29 szSystemRoot,
30 ARRAYSIZE(szSystemRoot)))
31 {
32 DPRINT1("Error: %lu\n", GetLastError());
33 return FALSE;
34 }
35
36 _wcsupr(szSystemRoot);
37
38 /* Get name postfix */
39 szSystemRoot[2] = L'.';
40 lpszPostfix = &szSystemRoot[2];
41 lpszPtr = lpszPostfix;
42 while (*lpszPtr != (WCHAR)0)
43 {
44 if (*lpszPtr == L'\\')
45 *lpszPtr = L'_';
46 lpszPtr++;
47 }
48
49 if (wcslen(lpName) + wcslen(lpszPostfix) + 1 >= dwMaxLength)
50 {
51 DPRINT1("Error: buffer overflow\n");
53 return FALSE;
54 }
55
56 wcscat(lpName, lpszPostfix);
57
58 return TRUE;
59}
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CreateStandardProfile().

◆ CopyDirectory()

BOOL CopyDirectory ( LPCWSTR  lpDestinationPath,
LPCWSTR  lpSourcePath 
)

Definition at line 82 of file directory.c.

84{
85 WCHAR szFileName[MAX_PATH];
86 WCHAR szFullSrcName[MAX_PATH];
87 WCHAR szFullDstName[MAX_PATH];
88 WIN32_FIND_DATAW FindFileData;
89 LPWSTR lpSrcPtr;
90 LPWSTR lpDstPtr;
91 HANDLE hFind;
92
93 DPRINT("CopyDirectory (%S, %S) called\n",
94 lpDestinationPath, lpSourcePath);
95
96 wcscpy(szFileName, lpSourcePath);
97 wcscat(szFileName, L"\\*.*");
98
99 hFind = FindFirstFileW(szFileName,
100 &FindFileData);
101 if (hFind == INVALID_HANDLE_VALUE)
102 {
103 DPRINT1("Error: %lu\n", GetLastError());
104 return FALSE;
105 }
106
107 wcscpy(szFullSrcName, lpSourcePath);
108 lpSrcPtr = AppendBackslash(szFullSrcName);
109
110 wcscpy(szFullDstName, lpDestinationPath);
111 lpDstPtr = AppendBackslash(szFullDstName);
112
113 for (;;)
114 {
115 if (wcscmp(FindFileData.cFileName, L".") &&
116 wcscmp(FindFileData.cFileName, L".."))
117 {
118 wcscpy(lpSrcPtr, FindFileData.cFileName);
119 wcscpy(lpDstPtr, FindFileData.cFileName);
120
121 if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
122 {
123 DPRINT("Create directory: %S\n", szFullDstName);
124 if (!CreateDirectoryExW(szFullSrcName, szFullDstName, NULL))
125 {
127 {
128 DPRINT1("Error: %lu\n", GetLastError());
129
130 FindClose(hFind);
131 return FALSE;
132 }
133 }
134
135 if (!CopyDirectory(szFullDstName, szFullSrcName))
136 {
137 DPRINT1("Error: %lu\n", GetLastError());
138
139 FindClose(hFind);
140 return FALSE;
141 }
142 }
143 else
144 {
145 DPRINT("Copy file: %S -> %S\n", szFullSrcName, szFullDstName);
146 if (!CopyFileW(szFullSrcName, szFullDstName, FALSE))
147 {
148 DPRINT1("Error: %lu\n", GetLastError());
149
150 FindClose(hFind);
151 return FALSE;
152 }
153 }
154 }
155
156 if (!FindNextFileW(hFind, &FindFileData))
157 {
159 {
160 DPRINT1("Error: %lu\n", GetLastError());
161 }
162
163 break;
164 }
165 }
166
167 FindClose(hFind);
168
169 DPRINT("CopyDirectory() done\n");
170
171 return TRUE;
172}
#define NULL
Definition: types.h:112
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI CreateDirectoryExW(IN LPCWSTR lpTemplateDirectory, IN LPCWSTR lpNewDirectory, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:193
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL CopyDirectory(LPCWSTR lpDestinationPath, LPCWSTR lpSourcePath)
Definition: directory.c:82
LPWSTR AppendBackslash(LPWSTR String)
Definition: misc.c:40
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define DPRINT
Definition: sndvol32.h:71
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121

Referenced by CopyDirectory(), CopyProfileDirectoryW(), CopySystemProfile(), and CreateUserProfileExW().

◆ CreateDefaultSecurityDescriptor()

PSECURITY_DESCRIPTOR CreateDefaultSecurityDescriptor ( VOID  )

Definition at line 57 of file misc.c.

58{
60 PSID AdministratorsSid = NULL;
61 PSID EveryoneSid = NULL;
62 PACL Dacl;
65
66 /* create the SYSTEM, Administrators and Everyone SIDs */
68 1,
70 0,
71 0,
72 0,
73 0,
74 0,
75 0,
76 0,
79 2,
82 0,
83 0,
84 0,
85 0,
86 0,
87 0,
88 &AdministratorsSid) ||
90 1,
92 0,
93 0,
94 0,
95 0,
96 0,
97 0,
98 0,
99 &EveryoneSid))
100 {
101 DPRINT1("Failed initializing the SIDs for the default security descriptor (0x%p, 0x%p, 0x%p)\n",
102 LocalSystemSid, AdministratorsSid, EveryoneSid);
103 goto Cleanup;
104 }
105
106 /* allocate the security descriptor and DACL */
107 DaclSize = sizeof(ACL) +
109 GetLengthSid(AdministratorsSid) +
110 GetLengthSid(EveryoneSid)) +
112 SidStart)));
113
116 if (pSD == NULL)
117 {
118 DPRINT1("Failed to allocate the default security descriptor and ACL\n");
119 goto Cleanup;
120 }
121
124 {
125 DPRINT1("Failed to initialize the default security descriptor\n");
126 goto Cleanup;
127 }
128
129 /* initialize and build the DACL */
130 Dacl = (PACL)((ULONG_PTR)pSD + sizeof(SECURITY_DESCRIPTOR));
131 if (!InitializeAcl(Dacl,
134 {
135 DPRINT1("Failed to initialize the DACL of the default security descriptor\n");
136 goto Cleanup;
137 }
138
139 /* add the SYSTEM Ace */
144 {
145 DPRINT1("Failed to add the SYSTEM ACE\n");
146 goto Cleanup;
147 }
148
149 /* add the Administrators Ace */
153 AdministratorsSid))
154 {
155 DPRINT1("Failed to add the Administrators ACE\n");
156 goto Cleanup;
157 }
158
159 /* add the Everyone Ace */
163 EveryoneSid))
164 {
165 DPRINT1("Failed to add the Everyone ACE\n");
166 goto Cleanup;
167 }
168
169 /* set the DACL */
171 TRUE,
172 Dacl,
173 FALSE))
174 {
175 DPRINT1("Failed to set the DACL of the default security descriptor\n");
176
177Cleanup:
178 if (pSD != NULL)
179 {
180 LocalFree((HLOCAL)pSD);
181 pSD = NULL;
182 }
183 }
184
185 if (LocalSystemSid != NULL)
186 {
188 }
189 if (AdministratorsSid != NULL)
190 {
191 FreeSid(AdministratorsSid);
192 }
193 if (EveryoneSid != NULL)
194 {
195 FreeSid(EveryoneSid);
196 }
197
198 return pSD;
199}
PSID LocalSystemSid
Definition: globals.c:16
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:1006
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:929
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:1039
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:919
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: misc.c:35
SID_IDENTIFIER_AUTHORITY LocalSystemAuthority
Definition: misc.c:34
static const WCHAR Cleanup[]
Definition: register.c:80
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
struct _SECURITY_DESCRIPTOR * PSECURITY_DESCRIPTOR
Definition: security.c:98
struct _ACL ACL
struct _SECURITY_DESCRIPTOR SECURITY_DESCRIPTOR
struct _ACL * PACL
Definition: security.c:105
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1593
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG DaclSize
Definition: rtlfuncs.h:1594
#define GENERIC_ALL
Definition: nt_native.h:92
#define GENERIC_EXECUTE
Definition: nt_native.h:91
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define LMEM_FIXED
Definition: winbase.h:368
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SECURITY_WORLD_RID
Definition: setypes.h:541
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:574
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define ACL_REVISION
Definition: setypes.h:39
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652

Referenced by EnterCriticalPolicySection(), and RegisterGPNotification().

◆ CreateDirectoryPath()

BOOL CreateDirectoryPath ( LPCWSTR  lpPathName,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Definition at line 176 of file directory.c.

178{
180 LPWSTR Ptr;
181 DWORD dwError;
182
183 DPRINT("CreateDirectoryPath() called\n");
184
185 if (lpPathName == NULL || *lpPathName == 0)
186 return TRUE;
187
188 if (CreateDirectoryW(lpPathName,
189 lpSecurityAttributes))
190 return TRUE;
191
192 dwError = GetLastError();
193 if (dwError == ERROR_ALREADY_EXISTS)
194 return TRUE;
195
196 wcscpy(szPath, lpPathName);
197
198 if (wcslen(szPath) > 3 && szPath[1] == ':' && szPath[2] == '\\')
199 {
200 Ptr = &szPath[3];
201 }
202 else
203 {
204 Ptr = szPath;
205 }
206
207 while (Ptr != NULL)
208 {
209 Ptr = wcschr(Ptr, L'\\');
210 if (Ptr != NULL)
211 *Ptr = 0;
212
213 DPRINT("CreateDirectory(%S)\n", szPath);
215 lpSecurityAttributes))
216 {
217 dwError = GetLastError();
218 if (dwError != ERROR_ALREADY_EXISTS)
219 return FALSE;
220 }
221
222 if (Ptr != NULL)
223 {
224 *Ptr = L'\\';
225 Ptr++;
226 }
227 }
228
229 DPRINT("CreateDirectoryPath() done\n");
230
231 return TRUE;
232}
#define wcschr
Definition: compat.h:17
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LPCWSTR szPath
Definition: env.c:37

Referenced by AddDesktopItemW(), and CreateGroupW().

◆ CreateUserHive()

BOOL CreateUserHive ( LPCWSTR  lpKeyName,
LPCWSTR  lpProfilePath 
)

Definition at line 57 of file registry.c.

59{
60 HKEY hDefaultKey = NULL;
61 HKEY hUserKey = NULL;
62 LONG Error;
63 BOOL Ret = FALSE;
64
65 DPRINT("CreateUserHive(%S) called\n", lpKeyName);
66
68 L".Default",
69 0,
71 &hDefaultKey);
72 if (Error != ERROR_SUCCESS)
73 {
75 goto Cleanup;
76 }
77
79 lpKeyName,
80 0,
82 &hUserKey);
83 if (Error != ERROR_SUCCESS)
84 {
86 goto Cleanup;
87 }
88
89 if (!CopyKey(hUserKey, hDefaultKey))
90 {
91 goto Cleanup;
92 }
93
94 if (!UpdateUsersShellFolderSettings(lpProfilePath,
95 hUserKey))
96 {
97 goto Cleanup;
98 }
99
100 RegFlushKey(hUserKey);
101 Ret = TRUE;
102
103Cleanup:
104 if (hUserKey != NULL)
105 RegCloseKey (hUserKey);
106
107 if (hDefaultKey != NULL)
108 RegCloseKey (hDefaultKey);
109
110 return Ret;
111}
BOOL Error
Definition: chkdsk.c:66
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2980
BOOL UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath, HKEY hUserKey)
Definition: setup.c:434
static BOOL CopyKey(HKEY hDstKey, HKEY hSrcKey)
Definition: registry.c:38
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
#define HKEY_USERS
Definition: winreg.h:13

Referenced by CreateUserProfileExW().

◆ GetUserSidStringFromToken()

BOOL GetUserSidStringFromToken ( HANDLE  hToken,
PUNICODE_STRING  SidString 
)

Definition at line 102 of file sid.c.

104{
105 PTOKEN_USER UserBuffer, nsb;
108
109 Length = 256;
110 UserBuffer = LocalAlloc(LPTR, Length);
111 if (UserBuffer == NULL)
112 return FALSE;
113
115 TokenUser,
116 (PVOID)UserBuffer,
117 Length,
118 &Length);
120 {
121 nsb = LocalReAlloc(UserBuffer,
122 Length,
124 if (nsb == NULL)
125 {
126 LocalFree(UserBuffer);
127 return FALSE;
128 }
129
130 UserBuffer = nsb;
132 TokenUser,
133 (PVOID)UserBuffer,
134 Length,
135 &Length);
136 }
137
138 if (!NT_SUCCESS (Status))
139 {
140 LocalFree(UserBuffer);
142 return FALSE;
143 }
144
145 DPRINT("SidLength: %lu\n", RtlLengthSid (UserBuffer->User.Sid));
146
148 UserBuffer->User.Sid,
149 TRUE);
150
151 LocalFree(UserBuffer);
152
153 if (!NT_SUCCESS(Status))
154 {
156 return FALSE;
157 }
158
159 DPRINT("SidString.Length: %lu\n", SidString->Length);
160 DPRINT("SidString.MaximumLength: %lu\n", SidString->MaximumLength);
161 DPRINT("SidString: '%wZ'\n", SidString);
162
163 return TRUE;
164}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSYSAPI NTSTATUS NTAPI RtlConvertSidToUnicodeString(OUT PUNICODE_STRING DestinationString, IN PVOID Sid, IN BOOLEAN AllocateDestinationString)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
SID_AND_ATTRIBUTES User
Definition: setypes.h:1010
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Queries a specific type of information in regard of an access token based upon the information class....
Definition: tokencls.c:473
#define LMEM_MOVEABLE
Definition: winbase.h:369
#define LPTR
Definition: winbase.h:381
@ TokenUser
Definition: setypes.h:966

Referenced by CheckForLoadedProfile(), CopySystemProfile(), GetCurrentUserKey(), GetProfileType(), GetUserProfileDirectoryW(), LoadUserProfileW(), and UnloadUserProfile().

◆ InitializeGPNotifications()

VOID InitializeGPNotifications ( VOID  )

Definition at line 65 of file gpolicy.c.

66{
68}
static CRITICAL_SECTION GPNotifyLock
Definition: gpolicy.c:56
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751

Referenced by DllMain().

◆ LoadDynamicImports()

BOOL LoadDynamicImports ( PDYN_MODULE  Module,
PDYN_FUNCS  DynFuncs 
)

Definition at line 223 of file misc.c.

225{
226 LPSTR *fname;
227 PVOID *fn;
228
229 ZeroMemory(DynFuncs, sizeof(DYN_FUNCS));
230
231 DynFuncs->hModule = LoadLibraryW(Module->Library);
232 if (!DynFuncs->hModule)
233 {
234 return FALSE;
235 }
236
237 fn = &DynFuncs->fn.foo;
238
239 /* load the imports */
240 for (fname = Module->Functions; *fname != NULL; fname++)
241 {
242 *fn = GetProcAddress(DynFuncs->hModule, *fname);
243 if (*fn == NULL)
244 {
245 FreeLibrary(DynFuncs->hModule);
246 DynFuncs->hModule = (HMODULE)0;
247
248 return FALSE;
249 }
250
251 fn++;
252 }
253
254 return TRUE;
255}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
HMODULE hModule
Definition: internal.h:49
union _DYN_FUNCS::@565 fn
PVOID foo
Definition: internal.h:52
LPWSTR Library
Definition: internal.h:64
LPSTR Functions[]
Definition: internal.h:65
HANDLE HMODULE
Definition: typedefs.h:77
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define ZeroMemory
Definition: winbase.h:1712
char * LPSTR
Definition: xmlstorage.h:182

Referenced by AddDesktopItemW(), and AddItemW().

◆ RemoveDirectoryPath()

BOOL RemoveDirectoryPath ( LPCWSTR  lpPathName)

Definition at line 324 of file directory.c.

325{
326 if (!RecursiveRemoveDir(lpPathName))
327 return FALSE;
328
329 DPRINT("Delete directory: '%S'\n", lpPathName);
330 return RemoveDirectoryW(lpPathName);
331}
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
static BOOL RecursiveRemoveDir(LPCWSTR lpPath)
Definition: directory.c:237

Referenced by DeleteGroupW(), and DeleteProfileW().

◆ UninitializeGPNotifications()

VOID UninitializeGPNotifications ( VOID  )

Definition at line 71 of file gpolicy.c.

72{
74
75 /* rundown the notification thread */
77 {
79
80 /* notify the thread */
83
85
86 /* wait for the thread to terminate itself */
88 INFINITE);
89
91
93 {
94 /* the handle should be closed by the thread,
95 just in case that didn't happen for an unknown reason */
98 }
99 }
100
102 {
105 }
106
108
110}
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
static HANDLE hNotificationThread
Definition: gpolicy.c:59
@ gpaTerminate
Definition: gpolicy.c:42
static GP_ACTION GPNotificationAction
Definition: gpolicy.c:58
static HANDLE hNotificationThreadEvent
Definition: gpolicy.c:60
#define ASSERT(a)
Definition: mode.c:44
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by DllMain().

◆ UnloadDynamicImports()

VOID UnloadDynamicImports ( PDYN_FUNCS  DynFuncs)

Definition at line 259 of file misc.c.

260{
261 if (DynFuncs->hModule)
262 {
263 FreeLibrary(DynFuncs->hModule);
264 DynFuncs->hModule = (HMODULE)0;
265 }
266}

Referenced by AddDesktopItemW(), and AddItemW().

◆ UpdateUsersShellFolderSettings()

BOOL UpdateUsersShellFolderSettings ( LPCWSTR  lpUserProfilePath,
HKEY  hUserKey 
)

Definition at line 434 of file setup.c.

436{
437 WCHAR szBuffer[MAX_PATH];
439 PFOLDERDATA lpFolderData;
440 HKEY hFoldersKey;
441 LONG Error;
442
443 DPRINT("UpdateUsersShellFolderSettings() called\n");
444
445 DPRINT("User profile path: %S\n", lpUserProfilePath);
446
447 Error = RegOpenKeyExW(hUserKey,
448 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
449 0,
451 &hFoldersKey);
452 if (Error != ERROR_SUCCESS)
453 {
454 DPRINT1("Error: %lu\n", Error);
456 return FALSE;
457 }
458
459 lpFolderData = &UserShellFolders[0];
460 while (lpFolderData->lpValueName != NULL)
461 {
462 if (lpFolderData->bShellFolder)
463 {
464 StringCbCopyW(szBuffer, sizeof(szBuffer), lpUserProfilePath);
465 StringCbCatW(szBuffer, sizeof(szBuffer), L"\\");
466
467 /* Append the folder name */
468 dwLength = wcslen(szBuffer);
470 lpFolderData->uId,
471 &szBuffer[dwLength],
472 ARRAYSIZE(szBuffer) - dwLength))
473 {
474 /* Use the default name instead */
475 StringCbCatW(szBuffer, sizeof(szBuffer), lpFolderData->lpPath);
476 }
477
478 DPRINT("%S: %S\n", lpFolderData->lpValueName, szBuffer);
479
480 dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
481 Error = RegSetValueExW(hFoldersKey,
482 lpFolderData->lpValueName,
483 0,
484 REG_SZ,
485 (LPBYTE)szBuffer,
486 dwLength);
487 if (Error != ERROR_SUCCESS)
488 {
489 DPRINT1("Error: %lu\n", Error);
490 RegCloseKey(hFoldersKey);
492 return FALSE;
493 }
494 }
495
496 lpFolderData++;
497 }
498
499 RegCloseKey(hFoldersKey);
500
501 DPRINT("UpdateUsersShellFolderSettings() done\n");
502
503 return TRUE;
504}
HINSTANCE hInstance
Definition: charmap.c:19
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4911
static DWORD DWORD * dwLength
Definition: fusion.c:86
static FOLDERDATA UserShellFolders[]
Definition: setup.c:29
#define REG_SZ
Definition: layer.c:22
#define KEY_SET_VALUE
Definition: nt_native.h:1017
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
UINT uId
Definition: setup.c:21
LPWSTR lpPath
Definition: setup.c:20
LPWSTR lpValueName
Definition: setup.c:19
BOOL bShellFolder
Definition: setup.c:23
unsigned char * LPBYTE
Definition: typedefs.h:53
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by CreateUserHive().

Variable Documentation

◆ DynOle32

DYN_MODULE DynOle32
extern

Definition at line 204 of file misc.c.

Referenced by AddDesktopItemW(), and AddItemW().

◆ hInstance

HINSTANCE hInstance
extern

Definition at line 19 of file charmap.c.

◆ LocalSystemAuthority

SID_IDENTIFIER_AUTHORITY LocalSystemAuthority
extern

Definition at line 34 of file misc.c.

Referenced by CheckForGuestsAndAdmins(), and CreateDefaultSecurityDescriptor().

◆ WorldAuthority

SID_IDENTIFIER_AUTHORITY WorldAuthority
extern

Definition at line 35 of file misc.c.

Referenced by CreateDefaultSecurityDescriptor().