Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/advapi32/advapi.c | 6 +- dlls/advapi32/cred.c | 76 ++++------ dlls/advapi32/crypt.c | 81 +++------- dlls/advapi32/lsa.c | 23 +-- dlls/advapi32/security.c | 316 ++++++++++++--------------------------- 5 files changed, 151 insertions(+), 351 deletions(-)
diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c index ebf2d234b52..33c63f3cb20 100644 --- a/dlls/advapi32/advapi.c +++ b/dlls/advapi32/advapi.c @@ -58,8 +58,7 @@ BOOL WINAPI GetUserNameA( LPSTR name, LPDWORD size ) */ BOOL WINAPI GetUserNameW( LPWSTR name, LPDWORD size ) { - static const WCHAR wineusernameW[] = {'W','I','N','E','U','S','E','R','N','A','M','E',0}; - DWORD len = GetEnvironmentVariableW( wineusernameW, name, *size ); + DWORD len = GetEnvironmentVariableW( L"WINEUSERNAME", name, *size ); BOOL ret;
if (!len) return FALSE; @@ -273,14 +272,13 @@ typedef UINT (WINAPI *fnMsiProvideComponentFromDescriptor)(LPCWSTR,LPWSTR,DWORD* DWORD WINAPI CommandLineFromMsiDescriptor( WCHAR *szDescriptor, WCHAR *szCommandLine, DWORD *pcchCommandLine ) { - static const WCHAR szMsi[] = { 'm','s','i',0 }; fnMsiProvideComponentFromDescriptor mpcfd; HMODULE hmsi; UINT r = ERROR_CALL_NOT_IMPLEMENTED;
TRACE("%s %p %p\n", debugstr_w(szDescriptor), szCommandLine, pcchCommandLine);
- hmsi = LoadLibraryW( szMsi ); + hmsi = LoadLibraryW( L"msi" ); if (!hmsi) return r; mpcfd = (fnMsiProvideComponentFromDescriptor)GetProcAddress( hmsi, diff --git a/dlls/advapi32/cred.c b/dlls/advapi32/cred.c index 86357e6b8f5..de94cb1b876 100644 --- a/dlls/advapi32/cred.c +++ b/dlls/advapi32/cred.c @@ -42,19 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(cred); /* the size of the ARC4 key used to encrypt the password data */ #define KEY_SIZE 8
-static const WCHAR wszCredentialManagerKey[] = {'S','o','f','t','w','a','r','e','\','W','i','n','e','\', - 'C','r','e','d','e','n','t','i','a','l',' ','M','a','n','a','g','e','r',0}; -static const WCHAR wszEncryptionKeyValue[] = {'E','n','c','r','y','p','t','i','o','n','K','e','y',0}; - -static const WCHAR wszFlagsValue[] = {'F','l','a','g','s',0}; -static const WCHAR wszTypeValue[] = {'T','y','p','e',0}; -static const WCHAR wszCommentValue[] = {'C','o','m','m','e','n','t',0}; -static const WCHAR wszLastWrittenValue[] = {'L','a','s','t','W','r','i','t','t','e','n',0}; -static const WCHAR wszPersistValue[] = {'P','e','r','s','i','s','t',0}; -static const WCHAR wszTargetAliasValue[] = {'T','a','r','g','e','t','A','l','i','a','s',0}; -static const WCHAR wszUserNameValue[] = {'U','s','e','r','N','a','m','e',0}; -static const WCHAR wszPasswordValue[] = {'P','a','s','s','w','o','r','d',0}; - static DWORD read_credential_blob(HKEY hkey, const BYTE key_data[KEY_SIZE], LPBYTE credential_blob, DWORD *credential_blob_size) @@ -63,7 +50,7 @@ static DWORD read_credential_blob(HKEY hkey, const BYTE key_data[KEY_SIZE], DWORD type;
*credential_blob_size = 0; - ret = RegQueryValueExW(hkey, wszPasswordValue, 0, &type, NULL, credential_blob_size); + ret = RegQueryValueExW(hkey, L"Password", 0, &type, NULL, credential_blob_size); if (ret != ERROR_SUCCESS) return ret; else if (type != REG_BINARY) @@ -73,7 +60,7 @@ static DWORD read_credential_blob(HKEY hkey, const BYTE key_data[KEY_SIZE], struct ustring data; struct ustring key;
- ret = RegQueryValueExW(hkey, wszPasswordValue, 0, &type, credential_blob, + ret = RegQueryValueExW(hkey, L"Password", 0, &type, credential_blob, credential_blob_size); if (ret != ERROR_SUCCESS) return ret; @@ -113,7 +100,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, buffer += count; }
- ret = RegQueryValueExW(hkey, wszCommentValue, 0, &type, NULL, &count); + ret = RegQueryValueExW(hkey, L"Comment", 0, &type, NULL, &count); if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS) return ret; else if (type != REG_SZ) @@ -122,7 +109,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, if (credential) { credential->Comment = (LPWSTR)buffer; - ret = RegQueryValueExW(hkey, wszCommentValue, 0, &type, (LPVOID)credential->Comment, + ret = RegQueryValueExW(hkey, L"Comment", 0, &type, (LPVOID)credential->Comment, &count); if (ret == ERROR_FILE_NOT_FOUND) credential->Comment = NULL; @@ -134,7 +121,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, buffer += count; }
- ret = RegQueryValueExW(hkey, wszTargetAliasValue, 0, &type, NULL, &count); + ret = RegQueryValueExW(hkey, L"TargetAlias", 0, &type, NULL, &count); if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS) return ret; else if (type != REG_SZ) @@ -143,7 +130,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, if (credential) { credential->TargetAlias = (LPWSTR)buffer; - ret = RegQueryValueExW(hkey, wszTargetAliasValue, 0, &type, (LPVOID)credential->TargetAlias, + ret = RegQueryValueExW(hkey, L"TargetAlias", 0, &type, (LPVOID)credential->TargetAlias, &count); if (ret == ERROR_FILE_NOT_FOUND) credential->TargetAlias = NULL; @@ -155,7 +142,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, buffer += count; }
- ret = RegQueryValueExW(hkey, wszUserNameValue, 0, &type, NULL, &count); + ret = RegQueryValueExW(hkey, L"UserName", 0, &type, NULL, &count); if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS) return ret; else if (type != REG_SZ) @@ -164,7 +151,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, if (credential) { credential->UserName = (LPWSTR)buffer; - ret = RegQueryValueExW(hkey, wszUserNameValue, 0, &type, (LPVOID)credential->UserName, + ret = RegQueryValueExW(hkey, L"UserName", 0, &type, (LPVOID)credential->UserName, &count); if (ret == ERROR_FILE_NOT_FOUND) credential->UserName = NULL; @@ -201,14 +188,14 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, if (!credential) return ERROR_SUCCESS;
count = sizeof(credential->Flags); - ret = RegQueryValueExW(hkey, wszFlagsValue, NULL, &type, (LPVOID)&credential->Flags, + ret = RegQueryValueExW(hkey, L"Flags", NULL, &type, (LPVOID)&credential->Flags, &count); if (ret != ERROR_SUCCESS) return ret; else if (type != REG_DWORD) return ERROR_REGISTRY_CORRUPT; count = sizeof(credential->Type); - ret = RegQueryValueExW(hkey, wszTypeValue, NULL, &type, (LPVOID)&credential->Type, + ret = RegQueryValueExW(hkey, L"Type", NULL, &type, (LPVOID)&credential->Type, &count); if (ret != ERROR_SUCCESS) return ret; @@ -216,14 +203,14 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential, return ERROR_REGISTRY_CORRUPT;
count = sizeof(credential->LastWritten); - ret = RegQueryValueExW(hkey, wszLastWrittenValue, NULL, &type, (LPVOID)&credential->LastWritten, + ret = RegQueryValueExW(hkey, L"LastWritten", NULL, &type, (LPVOID)&credential->LastWritten, &count); if (ret != ERROR_SUCCESS) return ret; else if (type != REG_BINARY) return ERROR_REGISTRY_CORRUPT; count = sizeof(credential->Persist); - ret = RegQueryValueExW(hkey, wszPersistValue, NULL, &type, (LPVOID)&credential->Persist, + ret = RegQueryValueExW(hkey, L"Persist", NULL, &type, (LPVOID)&credential->Persist, &count); if (ret == ERROR_SUCCESS && type != REG_DWORD) return ERROR_REGISTRY_CORRUPT; @@ -250,7 +237,7 @@ static DWORD write_credential_blob(HKEY hkey, LPCWSTR target_name, DWORD type, data.Buffer = encrypted_credential_blob; SystemFunction032(&data, &key);
- ret = RegSetValueExW(hkey, wszPasswordValue, 0, REG_BINARY, encrypted_credential_blob, credential_blob_size); + ret = RegSetValueExW(hkey, L"Password", 0, REG_BINARY, encrypted_credential_blob, credential_blob_size); heap_free(encrypted_credential_blob);
return ret; @@ -264,10 +251,10 @@ static DWORD registry_write_credential(HKEY hkey, const CREDENTIALW *credential,
GetSystemTimeAsFileTime(&LastWritten);
- ret = RegSetValueExW(hkey, wszFlagsValue, 0, REG_DWORD, (const BYTE*)&credential->Flags, + ret = RegSetValueExW(hkey, L"Flags", 0, REG_DWORD, (const BYTE*)&credential->Flags, sizeof(credential->Flags)); if (ret != ERROR_SUCCESS) return ret; - ret = RegSetValueExW(hkey, wszTypeValue, 0, REG_DWORD, (const BYTE*)&credential->Type, + ret = RegSetValueExW(hkey, L"Type", 0, REG_DWORD, (const BYTE*)&credential->Type, sizeof(credential->Type)); if (ret != ERROR_SUCCESS) return ret; ret = RegSetValueExW(hkey, NULL, 0, REG_SZ, (LPVOID)credential->TargetName, @@ -275,26 +262,26 @@ static DWORD registry_write_credential(HKEY hkey, const CREDENTIALW *credential, if (ret != ERROR_SUCCESS) return ret; if (credential->Comment) { - ret = RegSetValueExW(hkey, wszCommentValue, 0, REG_SZ, (LPVOID)credential->Comment, + ret = RegSetValueExW(hkey, L"Comment", 0, REG_SZ, (LPVOID)credential->Comment, sizeof(WCHAR)*(lstrlenW(credential->Comment)+1)); if (ret != ERROR_SUCCESS) return ret; } - ret = RegSetValueExW(hkey, wszLastWrittenValue, 0, REG_BINARY, (LPVOID)&LastWritten, + ret = RegSetValueExW(hkey, L"LastWritten", 0, REG_BINARY, (LPVOID)&LastWritten, sizeof(LastWritten)); if (ret != ERROR_SUCCESS) return ret; - ret = RegSetValueExW(hkey, wszPersistValue, 0, REG_DWORD, (const BYTE*)&credential->Persist, + ret = RegSetValueExW(hkey, L"Persist", 0, REG_DWORD, (const BYTE*)&credential->Persist, sizeof(credential->Persist)); if (ret != ERROR_SUCCESS) return ret; /* FIXME: Attributes */ if (credential->TargetAlias) { - ret = RegSetValueExW(hkey, wszTargetAliasValue, 0, REG_SZ, (LPVOID)credential->TargetAlias, + ret = RegSetValueExW(hkey, L"TargetAlias", 0, REG_SZ, (LPVOID)credential->TargetAlias, sizeof(WCHAR)*(lstrlenW(credential->TargetAlias)+1)); if (ret != ERROR_SUCCESS) return ret; } if (credential->UserName) { - ret = RegSetValueExW(hkey, wszUserNameValue, 0, REG_SZ, (LPVOID)credential->UserName, + ret = RegSetValueExW(hkey, L"UserName", 0, REG_SZ, (LPVOID)credential->UserName, sizeof(WCHAR)*(lstrlenW(credential->UserName)+1)); if (ret != ERROR_SUCCESS) return ret; } @@ -377,7 +364,7 @@ static DWORD host_write_credential( const CREDENTIALW *credential, BOOL preserve
static DWORD open_cred_mgr_key(HKEY *hkey, BOOL open_for_write) { - return RegCreateKeyExW(HKEY_CURRENT_USER, wszCredentialManagerKey, 0, + return RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\Wine\Credential Manager", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | (open_for_write ? KEY_WRITE : 0), NULL, hkey, NULL); } @@ -395,7 +382,7 @@ static DWORD get_cred_mgr_encryption_key(HKEY hkeyMgr, BYTE key_data[KEY_SIZE]) memcpy(key_data, my_key_data, KEY_SIZE);
count = KEY_SIZE; - ret = RegQueryValueExW(hkeyMgr, wszEncryptionKeyValue, NULL, &type, key_data, + ret = RegQueryValueExW(hkeyMgr, L"EncryptionKey", NULL, &type, key_data, &count); if (ret == ERROR_SUCCESS) { @@ -415,14 +402,14 @@ static DWORD get_cred_mgr_encryption_key(HKEY hkeyMgr, BYTE key_data[KEY_SIZE]) value = RtlUniform(&seed); *(DWORD *)(key_data + 4) = value;
- ret = RegSetValueExW(hkeyMgr, wszEncryptionKeyValue, 0, REG_BINARY, + ret = RegSetValueExW(hkeyMgr, L"EncryptionKey", 0, REG_BINARY, key_data, KEY_SIZE); if (ret == ERROR_ACCESS_DENIED) { ret = open_cred_mgr_key(&hkeyMgr, TRUE); if (ret == ERROR_SUCCESS) { - ret = RegSetValueExW(hkeyMgr, wszEncryptionKeyValue, 0, REG_BINARY, + ret = RegSetValueExW(hkeyMgr, L"EncryptionKey", 0, REG_BINARY, key_data, KEY_SIZE); RegCloseKey(hkeyMgr); } @@ -432,8 +419,6 @@ static DWORD get_cred_mgr_encryption_key(HKEY hkeyMgr, BYTE key_data[KEY_SIZE])
static LPWSTR get_key_name_for_target(LPCWSTR target_name, DWORD type) { - static const WCHAR wszGenericPrefix[] = {'G','e','n','e','r','i','c',':',' ',0}; - static const WCHAR wszDomPasswdPrefix[] = {'D','o','m','P','a','s','s','w','d',':',' ',0}; INT len; LPCWSTR prefix = NULL; LPWSTR key_name, p; @@ -441,13 +426,13 @@ static LPWSTR get_key_name_for_target(LPCWSTR target_name, DWORD type) len = lstrlenW(target_name); if (type == CRED_TYPE_GENERIC) { - prefix = wszGenericPrefix; - len += ARRAY_SIZE(wszGenericPrefix); + prefix = L"Generic: "; + len += ARRAY_SIZE(L"Generic: "); } else { - prefix = wszDomPasswdPrefix; - len += ARRAY_SIZE(wszDomPasswdPrefix); + prefix = L"DomPasswd: "; + len += ARRAY_SIZE(L"DomPasswd: "); }
key_name = heap_alloc(len * sizeof(WCHAR)); @@ -916,7 +901,6 @@ BOOL WINAPI CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count, #define CRED_DATA_SIZE 2048 static DWORD host_enumerate_credentials( const WCHAR *filter, CREDENTIALW **credentials, char *buf, DWORD *len, DWORD *count ) { - static const WCHAR emptyW[] = {0}; struct mountmgr_credential_list *list, *tmp; DWORD i, j, ret, size, filter_size, offset = 0; HANDLE mgr; @@ -925,8 +909,8 @@ static DWORD host_enumerate_credentials( const WCHAR *filter, CREDENTIALW **cred if (filter) filter_size = (lstrlenW( filter ) + 1) * sizeof(WCHAR); else { - filter = emptyW; - filter_size = sizeof(emptyW); + filter = L""; + filter_size = sizeof(L""); }
mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index 2877c61bf69..e28b6f96699 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -59,13 +59,7 @@ static HWND crypt_hWindow;
static inline PWSTR CRYPT_GetProvKeyName(PCWSTR pProvName) { - static const WCHAR KEYSTR[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y','\', - 'D','e','f','a','u','l','t','s','\', - 'P','r','o','v','i','d','e','r','\',0 - }; + static const WCHAR KEYSTR[] = L"Software\Microsoft\Cryptography\Defaults\Provider\"; PWSTR keyname;
keyname = CRYPT_Alloc((lstrlenW(KEYSTR) + lstrlenW(pProvName) +1)*sizeof(WCHAR)); @@ -80,20 +74,8 @@ static inline PWSTR CRYPT_GetProvKeyName(PCWSTR pProvName)
static inline PWSTR CRYPT_GetTypeKeyName(DWORD dwType, BOOL user) { - static const WCHAR MACHINESTR[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y','\', - 'D','e','f','a','u','l','t','s','\', - 'P','r','o','v','i','d','e','r',' ','T','y','p','e','s','\', - 'T','y','p','e',' ','X','X','X',0 - }; - static const WCHAR USERSTR[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y','\', - 'P','r','o','v','i','d','e','r',' ','T','y','p','e',' ','X','X','X',0 - }; + static const WCHAR MACHINESTR[] = L"Software\Microsoft\Cryptography\Defaults\Provider Types\Type XXX"; + static const WCHAR USERSTR[] = L"Software\Microsoft\Cryptography\Provider Type XXX"; PWSTR keyname; PWSTR ptr;
@@ -272,22 +254,16 @@ error:
static void CRYPT_CreateMachineGuid(void) { - static const WCHAR cryptographyW[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y',0 }; - static const WCHAR machineGuidW[] = { - 'M','a','c','h','i','n','e','G','u','i','d',0 }; LONG r; HKEY key;
- r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, cryptographyW, 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, + r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\Microsoft\Cryptography", 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &key); if (!r) { DWORD size;
- r = RegQueryValueExW(key, machineGuidW, NULL, NULL, NULL, &size); + r = RegQueryValueExW(key, L"MachineGuid", NULL, NULL, NULL, &size); if (r == ERROR_FILE_NOT_FOUND) { UUID uuid; @@ -301,7 +277,7 @@ static void CRYPT_CreateMachineGuid(void) uuid.Data4[2], uuid.Data4[3], uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7] ); - RegSetValueExW(key, machineGuidW, 0, REG_SZ, + RegSetValueExW(key, L"MachineGuid", 0, REG_SZ, (const BYTE *)buf, (lstrlenW(buf)+1)*sizeof(WCHAR)); } @@ -351,9 +327,6 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, PSTR provnameA = NULL, pszContainerA = NULL; DWORD keytype, type, len; ULONG r; - static const WCHAR nameW[] = {'N','a','m','e',0}; - static const WCHAR typeW[] = {'T','y','p','e',0}; - static const WCHAR imagepathW[] = {'I','m','a','g','e',' ','P','a','t','h',0};
TRACE("(%p, %s, %s, %d, %08x)\n", phProv, debugstr_w(pszContainer), debugstr_w(pszProvider), dwProvType, dwFlags); @@ -401,7 +374,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, } } CRYPT_Free(keyname); - r = RegQueryValueExW(key, nameW, NULL, &keytype, NULL, &len); + r = RegQueryValueExW(key, L"Name", NULL, &keytype, NULL, &len); if( r != ERROR_SUCCESS || !len || keytype != REG_SZ) { TRACE("error %d reading size of 'Name' from registry\n", r ); @@ -415,7 +388,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto error; } - r = RegQueryValueExW(key, nameW, NULL, NULL, (LPBYTE)provname, &len); + r = RegQueryValueExW(key, L"Name", NULL, NULL, (LPBYTE)provname, &len); if( r != ERROR_SUCCESS ) { TRACE("error %d reading 'Name' from registry\n", r ); @@ -442,7 +415,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, goto error; } len = sizeof(DWORD); - r = RegQueryValueExW(key, typeW, NULL, NULL, (BYTE*)&type, &len); + r = RegQueryValueExW(key, L"Type", NULL, NULL, (BYTE*)&type, &len); if (r != ERROR_SUCCESS) { SetLastError(NTE_PROV_TYPE_ENTRY_BAD); @@ -455,7 +428,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, goto error; }
- r = RegQueryValueExW(key, imagepathW, NULL, &keytype, NULL, &len); + r = RegQueryValueExW(key, L"Image Path", NULL, &keytype, NULL, &len); if ( r != ERROR_SUCCESS || keytype != REG_SZ) { TRACE("error %d reading size of 'Image Path' from registry\n", r ); @@ -469,7 +442,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto error; } - r = RegQueryValueExW(key, imagepathW, NULL, NULL, (LPBYTE)temp, &len); + r = RegQueryValueExW(key, L"Image Path", NULL, NULL, (LPBYTE)temp, &len); if( r != ERROR_SUCCESS ) { TRACE("error %d reading 'Image Path' from registry\n", r ); @@ -1125,14 +1098,6 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName) { HKEY hKey; - static const WCHAR providerW[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y','\', - 'D','e','f','a','u','l','t','s','\', - 'P','r','o','v','i','d','e','r',0 - }; - static const WCHAR typeW[] = {'T','y','p','e',0}; BOOL ret;
TRACE("(%d, %p, %d, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, @@ -1149,7 +1114,7 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, return FALSE; }
- if (RegOpenKeyW(HKEY_LOCAL_MACHINE, providerW, &hKey)) + if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\Microsoft\Cryptography\Defaults\Provider", &hKey)) { SetLastError(NTE_FAIL); return FALSE; @@ -1199,7 +1164,7 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, return FALSE; }
- if (RegQueryValueExW(subkey, typeW, NULL, NULL, (BYTE*)pdwProvType, &size)) + if (RegQueryValueExW(subkey, L"Type", NULL, NULL, (BYTE*)pdwProvType, &size)) ret = FALSE;
RegCloseKey(subkey); @@ -1275,14 +1240,6 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, DWORD keylen, numkeys, dwType; PWSTR keyname, ch; DWORD result; - static const WCHAR KEYSTR[] = { - 'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'C','r','y','p','t','o','g','r','a','p','h','y','\', - 'D','e','f','a','u','l','t','s','\', - 'P','r','o','v','i','d','e','r',' ','T','y','p','e','s',0 - }; - static const WCHAR typenameW[] = {'T','y','p','e','N','a','m','e',0};
TRACE("(%d, %p, %08x, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszTypeName, pcbTypeName); @@ -1298,7 +1255,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, return FALSE; }
- if (RegOpenKeyW(HKEY_LOCAL_MACHINE, KEYSTR, &hKey)) + if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\Microsoft\Cryptography\Defaults\Provider Types", &hKey)) return FALSE;
RegQueryInfoKeyW(hKey, NULL, NULL, NULL, &numkeys, &keylen, NULL, NULL, NULL, NULL, NULL, NULL); @@ -1330,7 +1287,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, *pdwProvType += (*(--ch) - '0') * 100; CRYPT_Free(keyname); - result = RegQueryValueExW(hSubkey, typenameW, NULL, &dwType, (LPBYTE)pszTypeName, pcbTypeName); + result = RegQueryValueExW(hSubkey, L"TypeName", NULL, &dwType, (LPBYTE)pszTypeName, pcbTypeName); if (result) { SetLastError(result); @@ -1494,7 +1451,6 @@ BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved, HKEY hKey; PWSTR keyname; DWORD result; - static const WCHAR nameW[] = {'N','a','m','e',0};
if (pdwReserved || !pcbProvName) { @@ -1524,7 +1480,7 @@ BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved, } CRYPT_Free(keyname); - result = RegQueryValueExW(hKey, nameW, NULL, NULL, (LPBYTE)pszProvName, pcbProvName); + result = RegQueryValueExW(hKey, L"Name", NULL, NULL, (LPBYTE)pszProvName, pcbProvName); RegCloseKey(hKey);
if (result) @@ -2057,7 +2013,6 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p { HKEY hProvKey, hTypeKey; PWSTR keyname; - static const WCHAR nameW[] = {'N','a','m','e',0};
TRACE("(%s, %d, %p, %08x)\n", debugstr_w(pszProvName), dwProvType, pdwReserved, dwFlags);
@@ -2094,7 +2049,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p if (dwFlags & CRYPT_DELETE_DEFAULT) { - RegDeleteValueW(hTypeKey, nameW); + RegDeleteValueW(hTypeKey, L"Name"); } else { @@ -2114,7 +2069,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p } CRYPT_Free(keyname); - if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, (const BYTE *)pszProvName, + if (RegSetValueExW(hTypeKey, L"Name", 0, REG_SZ, (const BYTE *)pszProvName, (lstrlenW(pszProvName) + 1)*sizeof(WCHAR))) { RegCloseKey(hTypeKey); diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c index 45b82c72c73..bd3585f8d06 100644 --- a/dlls/advapi32/lsa.c +++ b/dlls/advapi32/lsa.c @@ -69,19 +69,11 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs) BYTE* ptr = NULL; UNICODE_STRING* ustr;
- static const WCHAR wVNETSUP[] = { - 'S','y','s','t','e','m','\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\', - 'S','e','r','v','i','c','e','s','\', - 'V','x','D','\','V','N','E','T','S','U','P','\0'}; - - ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wVNETSUP, 0, KEY_READ, &key); + ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"System\CurrentControlSet\Services\VxD\VNETSUP", 0, KEY_READ, &key); if (ret == ERROR_SUCCESS) { DWORD size = 0; - static const WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 }; - - ret = RegQueryValueExW(key, wg, NULL, NULL, NULL, &size); + ret = RegQueryValueExW(key, L"Workgroup", NULL, NULL, NULL, &size); if (ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS) { ptr = heap_alloc_zero(sz + size); @@ -89,7 +81,7 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs) ustr = (UNICODE_STRING*)(ptr + ofs); ustr->MaximumLength = size; ustr->Buffer = (WCHAR*)(ptr + sz); - ret = RegQueryValueExW(key, wg, NULL, NULL, (LPBYTE)ustr->Buffer, &size); + ret = RegQueryValueExW(key, L"Workgroup", NULL, NULL, (LPBYTE)ustr->Buffer, &size); if (ret != ERROR_SUCCESS) { heap_free(ptr); @@ -101,14 +93,13 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs) } if (!ptr) { - static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'}; - ptr = heap_alloc_zero(sz + sizeof(wDomain)); + ptr = heap_alloc_zero(sz + sizeof(L"DOMAIN")); if (!ptr) return NULL; ustr = (UNICODE_STRING*)(ptr + ofs); - ustr->MaximumLength = sizeof(wDomain); + ustr->MaximumLength = sizeof(L"DOMAIN"); ustr->Buffer = (WCHAR*)(ptr + sz); - ustr->Length = sizeof(wDomain) - sizeof(WCHAR); - memcpy(ustr->Buffer, wDomain, sizeof(wDomain)); + ustr->Length = sizeof(L"DOMAIN") - sizeof(WCHAR); + memcpy(ustr->Buffer, L"DOMAIN", sizeof(L"DOMAIN")); } return ptr; } diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 943386abe8e..a01791bbf0b 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -63,116 +63,52 @@ typedef struct _AccountSid { LPCWSTR alias; } AccountSid;
-static const WCHAR Account_Operators[] = { 'A','c','c','o','u','n','t',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR Administrator[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0 }; -static const WCHAR Administrators[] = { 'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0 }; -static const WCHAR ALL_APPLICATION_PACKAGES[] = { 'A','L','L',' ','A','P','P','L','I','C','A','T','I','O','N',' ','P','A','C','K','A','G','E','S',0 }; -static const WCHAR ANONYMOUS_LOGON[] = { 'A','N','O','N','Y','M','O','U','S',' ','L','O','G','O','N',0 }; -static const WCHAR APPLICATION_PACKAGE_AUTHORITY[] = { 'A','P','P','L','I','C','A','T','I','O','N',' ','P','A','C','K','A','G','E',' ','A','U','T','H','O','R','I','T','Y',0 }; -static const WCHAR Authenticated_Users[] = { 'A','u','t','h','e','n','t','i','c','a','t','e','d',' ','U','s','e','r','s',0 }; -static const WCHAR Backup_Operators[] = { 'B','a','c','k','u','p',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR BATCH[] = { 'B','A','T','C','H',0 }; -static const WCHAR Blank[] = { 0 }; -static const WCHAR BUILTIN[] = { 'B','U','I','L','T','I','N',0 }; -static const WCHAR Cert_Publishers[] = { 'C','e','r','t',' ','P','u','b','l','i','s','h','e','r','s',0 }; -static const WCHAR CREATOR_GROUP[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',0 }; -static const WCHAR CREATOR_GROUP_SERVER[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',' ','S','E','R','V','E','R',0 }; -static const WCHAR CREATOR_OWNER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',0 }; -static const WCHAR CREATOR_OWNER_SERVER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',' ','S','E','R','V','E','R',0 }; -static const WCHAR CURRENT_USER[] = { 'C','U','R','R','E','N','T','_','U','S','E','R',0 }; -static const WCHAR DIALUP[] = { 'D','I','A','L','U','P',0 }; -static const WCHAR Digest_Authentication[] = { 'D','i','g','e','s','t',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR Domain_Admins[] = { 'D','o','m','a','i','n',' ','A','d','m','i','n','s',0 }; -static const WCHAR Domain_Computers[] = { 'D','o','m','a','i','n',' ','C','o','m','p','u','t','e','r','s',0 }; -static const WCHAR Domain_Controllers[] = { 'D','o','m','a','i','n',' ','C','o','n','t','r','o','l','l','e','r','s',0 }; -static const WCHAR Domain_Guests[] = { 'D','o','m','a','i','n',' ','G','u','e','s','t','s',0 }; -static const WCHAR None[] = { 'N','o','n','e',0 }; -static const WCHAR Enterprise_Admins[] = { 'E','n','t','e','r','p','r','i','s','e',' ','A','d','m','i','n','s',0 }; -static const WCHAR ENTERPRISE_DOMAIN_CONTROLLERS[] = { 'E','N','T','E','R','P','R','I','S','E',' ','D','O','M','A','I','N',' ','C','O','N','T','R','O','L','L','E','R','S',0 }; -static const WCHAR Everyone[] = { 'E','v','e','r','y','o','n','e',0 }; -static const WCHAR Group_Policy_Creator_Owners[] = { 'G','r','o','u','p',' ','P','o','l','i','c','y',' ','C','r','e','a','t','o','r',' ','O','w','n','e','r','s',0 }; -static const WCHAR Guest[] = { 'G','u','e','s','t',0 }; -static const WCHAR Guests[] = { 'G','u','e','s','t','s',0 }; -static const WCHAR INTERACTIVE[] = { 'I','N','T','E','R','A','C','T','I','V','E',0 }; -static const WCHAR LOCAL[] = { 'L','O','C','A','L',0 }; -static const WCHAR LOCAL_SERVICE[] = { 'L','O','C','A','L',' ','S','E','R','V','I','C','E',0 }; -static const WCHAR LOCAL_SERVICE2[] = { 'L','O','C','A','L','S','E','R','V','I','C','E',0 }; -static const WCHAR NETWORK[] = { 'N','E','T','W','O','R','K',0 }; -static const WCHAR Network_Configuration_Operators[] = { 'N','e','t','w','o','r','k',' ','C','o','n','f','i','g','u','r','a','t','i','o','n',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR NETWORK_SERVICE[] = { 'N','E','T','W','O','R','K',' ','S','E','R','V','I','C','E',0 }; -static const WCHAR NETWORK_SERVICE2[] = { 'N','E','T','W','O','R','K','S','E','R','V','I','C','E',0 }; -static const WCHAR NT_AUTHORITY[] = { 'N','T',' ','A','U','T','H','O','R','I','T','Y',0 }; -static const WCHAR NT_Pseudo_Domain[] = { 'N','T',' ','P','s','e','u','d','o',' ','D','o','m','a','i','n',0 }; -static const WCHAR NTML_Authentication[] = { 'N','T','M','L',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR NULL_SID[] = { 'N','U','L','L',' ','S','I','D',0 }; -static const WCHAR Other_Organization[] = { 'O','t','h','e','r',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 }; -static const WCHAR Performance_Log_Users[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','L','o','g',' ','U','s','e','r','s',0 }; -static const WCHAR Performance_Monitor_Users[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','M','o','n','i','t','o','r',' ','U','s','e','r','s',0 }; -static const WCHAR Power_Users[] = { 'P','o','w','e','r',' ','U','s','e','r','s',0 }; -static const WCHAR Pre_Windows_2000_Compatible_Access[] = { 'P','r','e','-','W','i','n','d','o','w','s',' ','2','0','0','0',' ','C','o','m','p','a','t','i','b','l','e',' ','A','c','c','e','s','s',0 }; -static const WCHAR Print_Operators[] = { 'P','r','i','n','t',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR PROXY[] = { 'P','R','O','X','Y',0 }; -static const WCHAR RAS_and_IAS_Servers[] = { 'R','A','S',' ','a','n','d',' ','I','A','S',' ','S','e','r','v','e','r','s',0 }; -static const WCHAR Remote_Desktop_Users[] = { 'R','e','m','o','t','e',' ','D','e','s','k','t','o','p',' ','U','s','e','r','s',0 }; -static const WCHAR REMOTE_INTERACTIVE_LOGON[] = { 'R','E','M','O','T','E',' ','I','N','T','E','R','A','C','T','I','V','E',' ','L','O','G','O','N',0 }; -static const WCHAR Replicators[] = { 'R','e','p','l','i','c','a','t','o','r','s',0 }; -static const WCHAR RESTRICTED[] = { 'R','E','S','T','R','I','C','T','E','D',0 }; -static const WCHAR SChannel_Authentication[] = { 'S','C','h','a','n','n','e','l',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR Schema_Admins[] = { 'S','c','h','e','m','a',' ','A','d','m','i','n','s',0 }; -static const WCHAR SELF[] = { 'S','E','L','F',0 }; -static const WCHAR Server_Operators[] = { 'S','e','r','v','e','r',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR SERVICE[] = { 'S','E','R','V','I','C','E',0 }; -static const WCHAR SYSTEM[] = { 'S','Y','S','T','E','M',0 }; -static const WCHAR TERMINAL_SERVER_USER[] = { 'T','E','R','M','I','N','A','L',' ','S','E','R','V','E','R',' ','U','S','E','R',0 }; -static const WCHAR This_Organization[] = { 'T','h','i','s',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 }; -static const WCHAR Users[] = { 'U','s','e','r','s',0 }; - static const AccountSid ACCOUNT_SIDS[] = { - { WinNullSid, NULL_SID, Blank, SidTypeWellKnownGroup }, - { WinWorldSid, Everyone, Blank, SidTypeWellKnownGroup }, - { WinLocalSid, LOCAL, Blank, SidTypeWellKnownGroup }, - { WinCreatorOwnerSid, CREATOR_OWNER, Blank, SidTypeWellKnownGroup }, - { WinCreatorGroupSid, CREATOR_GROUP, Blank, SidTypeWellKnownGroup }, - { WinCreatorOwnerServerSid, CREATOR_OWNER_SERVER, Blank, SidTypeWellKnownGroup }, - { WinCreatorGroupServerSid, CREATOR_GROUP_SERVER, Blank, SidTypeWellKnownGroup }, - { WinNtAuthoritySid, NT_Pseudo_Domain, NT_Pseudo_Domain, SidTypeDomain }, - { WinDialupSid, DIALUP, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinNetworkSid, NETWORK, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinBatchSid, BATCH, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinInteractiveSid, INTERACTIVE, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinServiceSid, SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinAnonymousSid, ANONYMOUS_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinProxySid, PROXY, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinEnterpriseControllersSid, ENTERPRISE_DOMAIN_CONTROLLERS, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinSelfSid, SELF, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinAuthenticatedUserSid, Authenticated_Users, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinRestrictedCodeSid, RESTRICTED, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinTerminalServerSid, TERMINAL_SERVER_USER, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinRemoteLogonIdSid, REMOTE_INTERACTIVE_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinLocalSystemSid, SYSTEM, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinLocalServiceSid, LOCAL_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup, LOCAL_SERVICE2 }, - { WinNetworkServiceSid, NETWORK_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup , NETWORK_SERVICE2}, - { WinBuiltinDomainSid, BUILTIN, BUILTIN, SidTypeDomain }, - { WinBuiltinAdministratorsSid, Administrators, BUILTIN, SidTypeAlias }, - { WinBuiltinUsersSid, Users, BUILTIN, SidTypeAlias }, - { WinBuiltinGuestsSid, Guests, BUILTIN, SidTypeAlias }, - { WinBuiltinPowerUsersSid, Power_Users, BUILTIN, SidTypeAlias }, - { WinBuiltinAccountOperatorsSid, Account_Operators, BUILTIN, SidTypeAlias }, - { WinBuiltinSystemOperatorsSid, Server_Operators, BUILTIN, SidTypeAlias }, - { WinBuiltinPrintOperatorsSid, Print_Operators, BUILTIN, SidTypeAlias }, - { WinBuiltinBackupOperatorsSid, Backup_Operators, BUILTIN, SidTypeAlias }, - { WinBuiltinReplicatorSid, Replicators, BUILTIN, SidTypeAlias }, - { WinBuiltinPreWindows2000CompatibleAccessSid, Pre_Windows_2000_Compatible_Access, BUILTIN, SidTypeAlias }, - { WinBuiltinRemoteDesktopUsersSid, Remote_Desktop_Users, BUILTIN, SidTypeAlias }, - { WinBuiltinNetworkConfigurationOperatorsSid, Network_Configuration_Operators, BUILTIN, SidTypeAlias }, - { WinNTLMAuthenticationSid, NTML_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinDigestAuthenticationSid, Digest_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinSChannelAuthenticationSid, SChannel_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinThisOrganizationSid, This_Organization, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinOtherOrganizationSid, Other_Organization, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinBuiltinPerfMonitoringUsersSid, Performance_Monitor_Users, BUILTIN, SidTypeAlias }, - { WinBuiltinPerfLoggingUsersSid, Performance_Log_Users, BUILTIN, SidTypeAlias }, - { WinBuiltinAnyPackageSid, ALL_APPLICATION_PACKAGES, APPLICATION_PACKAGE_AUTHORITY, SidTypeWellKnownGroup }, + { WinNullSid, L"NULL SID", L"", SidTypeWellKnownGroup }, + { WinWorldSid, L"Everyone", L"", SidTypeWellKnownGroup }, + { WinLocalSid, L"LOCAL", L"", SidTypeWellKnownGroup }, + { WinCreatorOwnerSid, L"CREATOR OWNER", L"", SidTypeWellKnownGroup }, + { WinCreatorGroupSid, L"CREATOR GROUP", L"", SidTypeWellKnownGroup }, + { WinCreatorOwnerServerSid, L"CREATOR OWNER SERVER", L"", SidTypeWellKnownGroup }, + { WinCreatorGroupServerSid, L"CREATOR GROUP SERVER", L"", SidTypeWellKnownGroup }, + { WinNtAuthoritySid, L"NT Pseudo Domain", L"NT Pseudo Domain", SidTypeDomain }, + { WinDialupSid, L"DIALUP", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinNetworkSid, L"NETWORK", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinBatchSid, L"BATCH", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinInteractiveSid, L"INTERACTIVE", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinServiceSid, L"SERVICE", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinAnonymousSid, L"ANONYMOUS LOGON", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinProxySid, L"PROXY", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinEnterpriseControllersSid, L"ENTERPRISE DOMAIN CONTROLLERS", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinSelfSid, L"SELF", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinAuthenticatedUserSid, L"Authenticated Users", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinRestrictedCodeSid, L"RESTRICTED", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinTerminalServerSid, L"TERMINAL SERVER USER", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinRemoteLogonIdSid, L"REMOTE INTERACTIVE LOGON", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinLocalSystemSid, L"SYSTEM", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinLocalServiceSid, L"LOCAL SERVICE", L"NT AUTHORITY", SidTypeWellKnownGroup, L"LOCALSERVICE" }, + { WinNetworkServiceSid, L"NETWORK SERVICE", L"NT AUTHORITY", SidTypeWellKnownGroup , L"NETWORKSERVICE"}, + { WinBuiltinDomainSid, L"BUILTIN", L"BUILTIN", SidTypeDomain }, + { WinBuiltinAdministratorsSid, L"Administrators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinUsersSid, L"Users", L"BUILTIN", SidTypeAlias }, + { WinBuiltinGuestsSid, L"Guests", L"BUILTIN", SidTypeAlias }, + { WinBuiltinPowerUsersSid, L"Power Users", L"BUILTIN", SidTypeAlias }, + { WinBuiltinAccountOperatorsSid, L"Account Operators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinSystemOperatorsSid, L"Server Operators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinPrintOperatorsSid, L"Print Operators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinBackupOperatorsSid, L"Backup Operators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinReplicatorSid, L"Replicators", L"BUILTIN", SidTypeAlias }, + { WinBuiltinPreWindows2000CompatibleAccessSid, L"Pre-Windows 2000 Compatible Access", L"BUILTIN", SidTypeAlias }, + { WinBuiltinRemoteDesktopUsersSid, L"Remote Desktop Users", L"BUILTIN", SidTypeAlias }, + { WinBuiltinNetworkConfigurationOperatorsSid, L"Network Configuration Operators", L"BUILTIN", SidTypeAlias }, + { WinNTLMAuthenticationSid, L"NTML Authentication", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinDigestAuthenticationSid, L"Digest Authentication", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinSChannelAuthenticationSid, L"SChannel Authentication", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinThisOrganizationSid, L"This Organization", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinOtherOrganizationSid, L"Other Organization", L"NT AUTHORITY", SidTypeWellKnownGroup }, + { WinBuiltinPerfMonitoringUsersSid, L"Performance Monitor Users", L"BUILTIN", SidTypeAlias }, + { WinBuiltinPerfLoggingUsersSid, L"Performance Log Users", L"BUILTIN", SidTypeAlias }, + { WinBuiltinAnyPackageSid, L"ALL APPLICATION PACKAGES", L"APPLICATION PACKAGE AUTHORITY", SidTypeWellKnownGroup }, };
const char * debugstr_sid(PSID sid) @@ -265,22 +201,18 @@ static inline DWORD get_security_service( LPWSTR full_service_name, DWORD access /* helper function for SE_REGISTRY_KEY objects in [Get|Set]NamedSecurityInfo */ static inline DWORD get_security_regkey( LPWSTR full_key_name, DWORD access, HANDLE *key ) { - static const WCHAR classes_rootW[] = {'C','L','A','S','S','E','S','_','R','O','O','T',0}; - static const WCHAR current_userW[] = {'C','U','R','R','E','N','T','_','U','S','E','R',0}; - static const WCHAR machineW[] = {'M','A','C','H','I','N','E',0}; - static const WCHAR usersW[] = {'U','S','E','R','S',0}; LPWSTR p = wcschr(full_key_name, '\'); int len = p-full_key_name; HKEY hParent;
if (!p) return ERROR_INVALID_PARAMETER; - if (wcsncmp( full_key_name, classes_rootW, len ) == 0) + if (!wcsncmp( full_key_name, L"CLASSES_ROOT", len )) hParent = HKEY_CLASSES_ROOT; - else if (wcsncmp( full_key_name, current_userW, len ) == 0) + else if (!wcsncmp( full_key_name, L"CURRENT_USER", len )) hParent = HKEY_CURRENT_USER; - else if (wcsncmp( full_key_name, machineW, len ) == 0) + else if (!wcsncmp( full_key_name, L"MACHINE", len )) hParent = HKEY_LOCAL_MACHINE; - else if (wcsncmp( full_key_name, usersW, len ) == 0) + else if (!wcsncmp( full_key_name, L"USERS", len )) hParent = HKEY_USERS; else return ERROR_INVALID_PARAMETER; @@ -519,99 +451,39 @@ done: return ret; }
- -static const WCHAR SE_CREATE_TOKEN_NAME_W[] = - { 'S','e','C','r','e','a','t','e','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_ASSIGNPRIMARYTOKEN_NAME_W[] = - { 'S','e','A','s','s','i','g','n','P','r','i','m','a','r','y','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_LOCK_MEMORY_NAME_W[] = - { 'S','e','L','o','c','k','M','e','m','o','r','y','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_INCREASE_QUOTA_NAME_W[] = - { 'S','e','I','n','c','r','e','a','s','e','Q','u','o','t','a','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_MACHINE_ACCOUNT_NAME_W[] = - { 'S','e','M','a','c','h','i','n','e','A','c','c','o','u','n','t','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_TCB_NAME_W[] = - { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SECURITY_NAME_W[] = - { 'S','e','S','e','c','u','r','i','t','y','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_TAKE_OWNERSHIP_NAME_W[] = - { 'S','e','T','a','k','e','O','w','n','e','r','s','h','i','p','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_LOAD_DRIVER_NAME_W[] = - { 'S','e','L','o','a','d','D','r','i','v','e','r','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SYSTEM_PROFILE_NAME_W[] = - { 'S','e','S','y','s','t','e','m','P','r','o','f','i','l','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SYSTEMTIME_NAME_W[] = - { 'S','e','S','y','s','t','e','m','t','i','m','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_PROF_SINGLE_PROCESS_NAME_W[] = - { 'S','e','P','r','o','f','i','l','e','S','i','n','g','l','e','P','r','o','c','e','s','s','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_INC_BASE_PRIORITY_NAME_W[] = - { 'S','e','I','n','c','r','e','a','s','e','B','a','s','e','P','r','i','o','r','i','t','y','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_CREATE_PAGEFILE_NAME_W[] = - { 'S','e','C','r','e','a','t','e','P','a','g','e','f','i','l','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_CREATE_PERMANENT_NAME_W[] = - { 'S','e','C','r','e','a','t','e','P','e','r','m','a','n','e','n','t','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_BACKUP_NAME_W[] = - { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_RESTORE_NAME_W[] = - { 'S','e','R','e','s','t','o','r','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SHUTDOWN_NAME_W[] = - { 'S','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_DEBUG_NAME_W[] = - { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_AUDIT_NAME_W[] = - { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SYSTEM_ENVIRONMENT_NAME_W[] = - { 'S','e','S','y','s','t','e','m','E','n','v','i','r','o','n','m','e','n','t','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_CHANGE_NOTIFY_NAME_W[] = - { 'S','e','C','h','a','n','g','e','N','o','t','i','f','y','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_REMOTE_SHUTDOWN_NAME_W[] = - { 'S','e','R','e','m','o','t','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_UNDOCK_NAME_W[] = - { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_SYNC_AGENT_NAME_W[] = - { 'S','e','S','y','n','c','A','g','e','n','t','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_ENABLE_DELEGATION_NAME_W[] = - { 'S','e','E','n','a','b','l','e','D','e','l','e','g','a','t','i','o','n','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_MANAGE_VOLUME_NAME_W[] = - { 'S','e','M','a','n','a','g','e','V','o','l','u','m','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_IMPERSONATE_NAME_W[] = - { 'S','e','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 }; -static const WCHAR SE_CREATE_GLOBAL_NAME_W[] = - { 'S','e','C','r','e','a','t','e','G','l','o','b','a','l','P','r','i','v','i','l','e','g','e',0 }; - static const WCHAR * const WellKnownPrivNames[SE_MAX_WELL_KNOWN_PRIVILEGE + 1] = { NULL, NULL, - SE_CREATE_TOKEN_NAME_W, - SE_ASSIGNPRIMARYTOKEN_NAME_W, - SE_LOCK_MEMORY_NAME_W, - SE_INCREASE_QUOTA_NAME_W, - SE_MACHINE_ACCOUNT_NAME_W, - SE_TCB_NAME_W, - SE_SECURITY_NAME_W, - SE_TAKE_OWNERSHIP_NAME_W, - SE_LOAD_DRIVER_NAME_W, - SE_SYSTEM_PROFILE_NAME_W, - SE_SYSTEMTIME_NAME_W, - SE_PROF_SINGLE_PROCESS_NAME_W, - SE_INC_BASE_PRIORITY_NAME_W, - SE_CREATE_PAGEFILE_NAME_W, - SE_CREATE_PERMANENT_NAME_W, - SE_BACKUP_NAME_W, - SE_RESTORE_NAME_W, - SE_SHUTDOWN_NAME_W, - SE_DEBUG_NAME_W, - SE_AUDIT_NAME_W, - SE_SYSTEM_ENVIRONMENT_NAME_W, - SE_CHANGE_NOTIFY_NAME_W, - SE_REMOTE_SHUTDOWN_NAME_W, - SE_UNDOCK_NAME_W, - SE_SYNC_AGENT_NAME_W, - SE_ENABLE_DELEGATION_NAME_W, - SE_MANAGE_VOLUME_NAME_W, - SE_IMPERSONATE_NAME_W, - SE_CREATE_GLOBAL_NAME_W, + L"SeCreateTokenPrivilege", + L"SeAssignPrimaryTokenPrivilege", + L"SeLockMemoryPrivilege", + L"SeIncreaseQuotaPrivilege", + L"SeMachineAccountPrivilege", + L"SeTcbPrivilege", + L"SeSecurityPrivilege", + L"SeTakeOwnershipPrivilege", + L"SeLoadDriverPrivilege", + L"SeSystemProfilePrivilege", + L"SeSystemtimePrivilege", + L"SeProfileSingleProcessPrivilege", + L"SeIncreaseBasePriorityPrivilege", + L"SeCreatePagefilePrivilege", + L"SeCreatePermanentPrivilege", + L"SeBackupPrivilege", + L"SeRestorePrivilege", + L"SeShutdownPrivilege", + L"SeDebugPrivilege", + L"SeAuditPrivilege", + L"SeSystemEnvironmentPrivilege", + L"SeChangeNotifyPrivilege", + L"SeRemoteShutdownPrivilege", + L"SeUndockPrivilege", + L"SeSyncAgentPrivilege", + L"SeEnableDelegationPrivilege", + L"SeManageVolumePrivilege", + L"SeImpersonatePrivilege", + L"SeCreateGlobalPrivilege", };
const WCHAR *get_wellknown_privilege_name(const LUID *luid) @@ -1001,7 +873,7 @@ LookupAccountSidW( if (result) { if (EqualSid(sid, &local)) { dm = computer_name; - ac = Blank; + ac = L""; use = 3; } else { local.SubAuthorityCount++; @@ -1011,41 +883,41 @@ LookupAccountSidW( use = 1; switch (((MAX_SID *)sid)->SubAuthority[4]) { case DOMAIN_USER_RID_ADMIN: - ac = Administrator; + ac = L"Administrator"; break; case DOMAIN_USER_RID_GUEST: - ac = Guest; + ac = L"Guest"; break; case DOMAIN_GROUP_RID_ADMINS: - ac = Domain_Admins; + ac = L"Domain Admins"; break; case DOMAIN_GROUP_RID_USERS: - ac = None; + ac = L"None"; use = SidTypeGroup; break; case DOMAIN_GROUP_RID_GUESTS: - ac = Domain_Guests; + ac = L"Domain Guests"; break; case DOMAIN_GROUP_RID_COMPUTERS: - ac = Domain_Computers; + ac = L"Domain Computers"; break; case DOMAIN_GROUP_RID_CONTROLLERS: - ac = Domain_Controllers; + ac = L"Domain Controllers"; break; case DOMAIN_GROUP_RID_CERT_ADMINS: - ac = Cert_Publishers; + ac = L"Cert Publishers"; break; case DOMAIN_GROUP_RID_SCHEMA_ADMINS: - ac = Schema_Admins; + ac = L"Schema Admins"; break; case DOMAIN_GROUP_RID_ENTERPRISE_ADMINS: - ac = Enterprise_Admins; + ac = L"Enterprise Admins"; break; case DOMAIN_GROUP_RID_POLICY_ADMINS: - ac = Group_Policy_Creator_Owners; + ac = L"Group Policy Creator Owners"; break; case DOMAIN_ALIAS_RID_RAS_SERVERS: - ac = RAS_and_IAS_Servers; + ac = L"RAS and IAS Servers"; break; case 1000: /* first user account */ size = UNLEN + 1; @@ -1519,9 +1391,9 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI return FALSE; }
- if (!lpAccountName || !wcscmp( lpAccountName, Blank )) + if (!lpAccountName || !wcscmp( lpAccountName, L"" )) { - lpAccountName = BUILTIN; + lpAccountName = L"BUILTIN"; }
RtlInitUnicodeString( &account, lpAccountName ); @@ -2146,7 +2018,7 @@ static DWORD trustee_to_sid( DWORD nDestinationSidLength, PSID pDestinationSid, DWORD sid_size = nDestinationSidLength; DWORD domain_size = MAX_COMPUTERNAME_LENGTH + 1; SID_NAME_USE use; - if (!wcscmp( pTrustee->ptstrName, CURRENT_USER )) + if (!wcscmp( pTrustee->ptstrName, L"CURRENT_USER" )) { if (!lookup_user_account_name( pDestinationSid, &sid_size, NULL, &domain_size, &use )) {