Commit 636d398c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ntdll: Use wide-char string literals.

parent 4da4e98a
......@@ -102,11 +102,10 @@ NTSTATUS WINAPI RtlDeleteAtomFromAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom
*/
static ULONG integral_atom_name(WCHAR* buffer, ULONG len, RTL_ATOM atom)
{
static const WCHAR fmt[] = {'#','%','u',0};
WCHAR tmp[16];
int ret;
ret = swprintf( tmp, ARRAY_SIZE(tmp), fmt, atom );
ret = swprintf( tmp, ARRAY_SIZE(tmp), L"#%u", atom );
if (!len) return ret * sizeof(WCHAR);
if (len <= ret) ret = len - 1;
memcpy( buffer, tmp, ret * sizeof(WCHAR) );
......
......@@ -50,8 +50,6 @@ static BOOL show_dot_files;
*/
void init_directories(void)
{
static const WCHAR WineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
static const WCHAR ShowDotFilesW[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
char tmp[80];
HANDLE root, hkey;
DWORD dummy;
......@@ -65,12 +63,12 @@ void init_directories(void)
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, WineW );
RtlInitUnicodeString( &nameW, L"Software\\Wine" );
/* @@ Wine registry key: HKCU\Software\Wine */
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
{
RtlInitUnicodeString( &nameW, ShowDotFilesW );
RtlInitUnicodeString( &nameW, L"ShowDotFiles" );
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
{
WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
......
......@@ -49,7 +49,7 @@ struct loadorder_list
module_loadorder_t *order;
};
static const WCHAR separatorsW[] = {',',' ','\t',0};
static const WCHAR separatorsW[] = L", \t";
static BOOL init_done;
static struct loadorder_list env_list;
......@@ -89,10 +89,9 @@ static const WCHAR *get_basename( const WCHAR *name )
*/
static inline void remove_dll_ext( WCHAR *name )
{
static const WCHAR dllW[] = {'.','d','l','l',0};
WCHAR *p = wcsrchr( name, '.' );
if (p && !wcsicmp( p, dllW )) *p = 0;
if (p && !wcsicmp( p, L".dll" )) *p = 0;
}
......@@ -224,7 +223,6 @@ static void add_load_order_set( WCHAR *entry )
*/
static void init_load_order(void)
{
static const WCHAR winedlloverridesW[] = {'W','I','N','E','D','L','L','O','V','E','R','R','I','D','E','S',0};
WCHAR *entry, *next, *order;
SIZE_T len = 1024;
NTSTATUS status;
......@@ -234,7 +232,7 @@ static void init_load_order(void)
for (;;)
{
order = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) );
status = RtlQueryEnvironmentVariable( NULL, winedlloverridesW, wcslen(winedlloverridesW),
status = RtlQueryEnvironmentVariable( NULL, L"WINEDLLOVERRIDES", wcslen(L"WINEDLLOVERRIDES"),
order, len - 1, &len );
if (!status)
{
......@@ -290,8 +288,6 @@ static inline enum loadorder get_env_load_order( const WCHAR *module )
*/
static HANDLE get_standard_key(void)
{
static const WCHAR DllOverridesW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'D','l','l','O','v','e','r','r','i','d','e','s',0};
static HANDLE std_key = (HANDLE)-1;
if (std_key == (HANDLE)-1)
......@@ -307,7 +303,7 @@ static HANDLE get_standard_key(void)
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, DllOverridesW );
RtlInitUnicodeString( &nameW, L"Software\\Wine\\DllOverrides" );
/* @@ Wine registry key: HKCU\Software\Wine\DllOverrides */
if (NtOpenKey( &std_key, KEY_ALL_ACCESS, &attr )) std_key = 0;
......@@ -328,20 +324,17 @@ static HANDLE get_app_key( const WCHAR *app_name )
UNICODE_STRING nameW;
HANDLE root;
WCHAR *str;
static const WCHAR AppDefaultsW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'A','p','p','D','e','f','a','u','l','t','s','\\',0};
static const WCHAR DllOverridesW[] = {'\\','D','l','l','O','v','e','r','r','i','d','e','s',0};
static HANDLE app_key = (HANDLE)-1;
if (app_key != (HANDLE)-1) return app_key;
str = RtlAllocateHeap( GetProcessHeap(), 0,
sizeof(AppDefaultsW) + sizeof(DllOverridesW) +
sizeof(L"Software\\Wine\\AppDefaults\\") + sizeof(L"\\DllOverrides") +
wcslen(app_name) * sizeof(WCHAR) );
if (!str) return 0;
wcscpy( str, AppDefaultsW );
wcscpy( str, L"Software\\Wine\\AppDefaults\\" );
wcscat( str, app_name );
wcscat( str, DllOverridesW );
wcscat( str, L"\\DllOverrides" );
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
attr.Length = sizeof(attr);
......@@ -425,7 +418,6 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
*/
enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name )
{
static const WCHAR nt_prefixW[] = {'\\','?','?','\\',0};
enum loadorder ret = LO_INVALID;
HANDLE std_key, app_key = 0;
const WCHAR *path = nt_name->Buffer;
......@@ -435,7 +427,7 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
if (!init_done) init_load_order();
std_key = get_standard_key();
if (app_name) app_key = get_app_key( app_name );
if (!wcsncmp( path, nt_prefixW, 4 )) path += 4;
if (!wcsncmp( path, L"\\??\\", 4 )) path += 4;
TRACE("looking for %s\n", debugstr_w(path));
......
......@@ -1269,8 +1269,6 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
{
/* locale name format is: lang[-script][-country][_modifier] */
static const WCHAR sepW[] = {'-','_',0};
const IMAGE_RESOURCE_DIRECTORY *resdir;
const IMAGE_RESOURCE_DIRECTORY_ENTRY *et;
LDR_RESOURCE_INFO info;
......@@ -1291,16 +1289,16 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
if (wcslen( name ) >= LOCALE_NAME_MAX_LENGTH) return STATUS_INVALID_PARAMETER_1;
wcscpy( lang, name );
if ((p = wcspbrk( lang, sepW )) && *p == '-')
if ((p = wcspbrk( lang, L"-_" )) && *p == '-')
{
*p++ = 0;
country = p;
if ((p = wcspbrk( p, sepW )) && *p == '-')
if ((p = wcspbrk( p, L"-_" )) && *p == '-')
{
*p++ = 0;
script = country;
country = p;
p = wcspbrk( p, sepW );
p = wcspbrk( p, L"-_" );
}
if (p) *p = 0; /* FIXME: modifier is ignored */
/* second value can be script or country, check length to resolve the ambiguity */
......
......@@ -31,10 +31,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(file);
static const WCHAR DeviceRootW[] = {'\\','\\','.','\\',0};
static const WCHAR NTDosPrefixW[] = {'\\','?','?','\\',0};
static const WCHAR UncPfxW[] = {'U','N','C','\\',0};
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
/***********************************************************************
......@@ -69,7 +65,6 @@ DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U( PCWSTR path )
*/
ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
{
static const WCHAR consoleW[] = {'\\','\\','.','\\','C','O','N',0};
static const WCHAR auxW[] = {'A','U','X'};
static const WCHAR comW[] = {'C','O','M'};
static const WCHAR conW[] = {'C','O','N'};
......@@ -87,7 +82,7 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
case UNC_PATH:
return 0;
case DEVICE_PATH:
if (!wcsicmp( dos_name, consoleW ))
if (!wcsicmp( dos_name, L"\\\\.\\CON" ))
return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */
return 0;
case ABSOLUTE_DRIVE_PATH:
......@@ -207,12 +202,12 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
return STATUS_NO_MEMORY;
}
wcscpy(ntpath->Buffer, NTDosPrefixW);
wcscpy(ntpath->Buffer, L"\\??\\");
switch (RtlDetermineDosPathNameType_U(ptr))
{
case UNC_PATH: /* \\foo */
offset = 2;
wcscat(ntpath->Buffer, UncPfxW);
wcscat(ntpath->Buffer, L"UNC\\");
break;
case DEVICE_PATH: /* \\.\foo */
offset = 4;
......@@ -661,7 +656,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer,
DWORD sz = LOWORD(dosdev); /* in bytes */
if (8 + sz + 2 > size) return sz + 10;
wcscpy(buffer, DeviceRootW);
wcscpy(buffer, L"\\\\.\\");
memmove(buffer + 4, name + offset, sz);
buffer[4 + sz / sizeof(WCHAR)] = '\0';
/* file_part isn't set in this case */
......@@ -874,7 +869,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
if (size && ptr[size - 1] != '\\') ptr[size++] = '\\';
/* convert \??\UNC\ path to \\ prefix */
if (size >= 4 && !wcsnicmp(ptr, UncPfxW, 4))
if (size >= 4 && !wcsnicmp(ptr, L"UNC\\", 4))
{
ptr += 2;
size -= 2;
......
......@@ -402,49 +402,30 @@ static NTSTATUS RTL_KeyHandleCreateObject(ULONG RelativeTo, PCWSTR Path, POBJECT
PCWSTR base;
INT len;
static const WCHAR empty[] = {0};
static const WCHAR control[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e',
'\\','S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'C','o','n','t','r','o','l','\\',0};
static const WCHAR devicemap[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
'H','a','r','d','w','a','r','e','\\','D','e','v','i','c','e','M','a','p','\\',0};
static const WCHAR services[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
'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','\\',0};
static const WCHAR user[] = {'\\','R','e','g','i','s','t','r','y','\\','U','s','e','r','\\',
'C','u','r','r','e','n','t','U','s','e','r','\\',0};
static const WCHAR windows_nt[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',0};
switch (RelativeTo & 0xff)
{
case RTL_REGISTRY_ABSOLUTE:
base = empty;
base = L"";
break;
case RTL_REGISTRY_CONTROL:
base = control;
base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\";
break;
case RTL_REGISTRY_DEVICEMAP:
base = devicemap;
base = L"\\Registry\\Machine\\Hardware\\DeviceMap\\";
break;
case RTL_REGISTRY_SERVICES:
base = services;
base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\";
break;
case RTL_REGISTRY_USER:
base = user;
base = L"\\Registry\\User\\CurrentUser\\";
break;
case RTL_REGISTRY_WINDOWS_NT:
base = windows_nt;
base = L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\";
break;
default:
......
......@@ -167,17 +167,6 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
OBJECT_ATTRIBUTES attr;
UNICODE_STRING name;
HANDLE root, hkey;
static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\',
'D','e','b','u','g',0};
static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
static const WCHAR RelayFromIncludeW[] = {'R','e','l','a','y','F','r','o','m','I','n','c','l','u','d','e',0};
static const WCHAR RelayFromExcludeW[] = {'R','e','l','a','y','F','r','o','m','E','x','c','l','u','d','e',0};
static const WCHAR SnoopFromIncludeW[] = {'S','n','o','o','p','F','r','o','m','I','n','c','l','u','d','e',0};
static const WCHAR SnoopFromExcludeW[] = {'S','n','o','o','p','F','r','o','m','E','x','c','l','u','d','e',0};
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
attr.Length = sizeof(attr);
......@@ -186,21 +175,21 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &name, configW );
RtlInitUnicodeString( &name, L"Software\\Wine\\Debug" );
/* @@ Wine registry key: HKCU\Software\Wine\Debug */
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
NtClose( root );
if (!hkey) return TRUE;
debug_relay_includelist = load_list( hkey, RelayIncludeW );
debug_relay_excludelist = load_list( hkey, RelayExcludeW );
debug_snoop_includelist = load_list( hkey, SnoopIncludeW );
debug_snoop_excludelist = load_list( hkey, SnoopExcludeW );
debug_from_relay_includelist = load_list( hkey, RelayFromIncludeW );
debug_from_relay_excludelist = load_list( hkey, RelayFromExcludeW );
debug_from_snoop_includelist = load_list( hkey, SnoopFromIncludeW );
debug_from_snoop_excludelist = load_list( hkey, SnoopFromExcludeW );
debug_relay_includelist = load_list( hkey, L"RelayInclude" );
debug_relay_excludelist = load_list( hkey, L"RelayExclude" );
debug_snoop_includelist = load_list( hkey, L"SnoopInclude" );
debug_snoop_excludelist = load_list( hkey, L"SnoopExclude" );
debug_from_relay_includelist = load_list( hkey, L"RelayFromInclude" );
debug_from_relay_excludelist = load_list( hkey, L"RelayFromExclude" );
debug_from_snoop_includelist = load_list( hkey, L"SnoopFromInclude" );
debug_from_snoop_excludelist = load_list( hkey, L"SnoopFromExclude" );
NtClose( hkey );
return TRUE;
......@@ -259,7 +248,6 @@ static BOOL check_relay_include( const WCHAR *module, int ordinal, const char *f
*/
static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludelist, const WCHAR *module )
{
static const WCHAR dllW[] = {'.','d','l','l',0 };
const WCHAR **listitem;
BOOL show;
......@@ -281,7 +269,7 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
if (!wcsicmp( *listitem, module )) return !show;
len = wcslen( *listitem );
if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, dllW ))
if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, L".dll" ))
return !show;
}
return show;
......
......@@ -1314,8 +1314,6 @@ NTSTATUS WINAPI RtlIpv6StringToAddressA(const char *str, const char **terminator
NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWSTR buffer, PULONG psize)
{
WCHAR tmp_ip[32];
static const WCHAR fmt_ip[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
static const WCHAR fmt_port[] = {':','%','u',0};
ULONG needed;
if (!pin || !buffer || !psize)
......@@ -1323,11 +1321,11 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWST
TRACE("(%p:0x%x, %d, %p, %p:%d)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), fmt_ip,
needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, fmt_port, ntohs(port));
if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, L":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
......
......@@ -1160,8 +1160,6 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
*/
BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
static const WCHAR std_control_chars[] = {'\r','\n','\t',' ',0x3000,0};
static const WCHAR byterev_control_chars[] = {0x0d00,0x0a00,0x0900,0x2000,0};
const WCHAR *s = buf;
int i;
unsigned int flags = ~0U, out_flags = 0;
......@@ -1225,7 +1223,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
for (i = 0; i < len; i++)
{
if (wcschr(std_control_chars, s[i]))
if (wcschr(L"\r\n\t \x3000", s[i]))
{
out_flags |= IS_TEXT_UNICODE_CONTROLS;
break;
......@@ -1237,7 +1235,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
for (i = 0; i < len; i++)
{
if (wcschr(byterev_control_chars, s[i]))
if (wcschr(L"\x0d00\x0a00\x0900\x2000", s[i]))
{
out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;
break;
......@@ -1684,11 +1682,6 @@ NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING str, GUID* guid)
*/
NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
{
static const WCHAR szFormat[] = { '{','%','0','8','l','X','-',
'%','0','4','X','-', '%','0','4','X','-','%','0','2','X','%','0','2','X',
'-', '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','}','\0' };
TRACE("(%p,%p)\n", guid, str);
str->Length = GUID_STRING_LENGTH * sizeof(WCHAR);
......@@ -1699,7 +1692,8 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
str->Length = str->MaximumLength = 0;
return STATUS_NO_MEMORY;
}
swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR), szFormat, guid->Data1, guid->Data2, guid->Data3,
swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR),
L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
......@@ -1739,7 +1733,6 @@ static UINT64 get_arg( int nr, struct format_message_args *args_data, BOOL is64
static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int insert, BOOLEAN ansi,
struct format_message_args *args_data )
{
static const WCHAR modifiers[] = {'0','1','2','3','4','5','6','7','8','9',' ','+','-','*','#','.',0};
const WCHAR *format = *src;
WCHAR *p, fmt[32];
ULONG_PTR args[5] = { 0 };
......@@ -1757,7 +1750,7 @@ static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int i
if (!end || end - format > ARRAY_SIZE(fmt) - 2) return STATUS_INVALID_PARAMETER;
*src = end + 1;
while (wcschr( modifiers, *format ))
while (wcschr( L"0123456789 +-*#.", *format ))
{
if (*format == '*') stars++;
*p++ = *format++;
......@@ -1829,7 +1822,6 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
BOOLEAN ansi, BOOLEAN is_array, __ms_va_list *args,
WCHAR *buffer, ULONG size, ULONG *retsize, ULONG flags )
{
static const WCHAR emptyW = 0;
static const WCHAR spaceW = ' ';
static const WCHAR crW = '\r';
static const WCHAR tabW = '\t';
......@@ -1945,7 +1937,7 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
}
}
if ((status = add_chars( &buffer, end, &emptyW, 1 ))) return status;
if ((status = add_chars( &buffer, end, L"", 1 ))) return status;
*retsize = (buffer - start) * sizeof(WCHAR);
return STATUS_SUCCESS;
......
......@@ -1617,21 +1617,20 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
PSID pSid,
BOOLEAN AllocateString)
{
static const WCHAR formatW[] = {'-','%','u',0};
WCHAR buffer[2 + 10 + 10 + 10 * SID_MAX_SUB_AUTHORITIES];
WCHAR *p = buffer;
const SID *sid = pSid;
DWORD i, len;
*p++ = 'S';
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->Revision );
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW,
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->Revision );
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u",
MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5],
sid->IdentifierAuthority.Value[4] ),
MAKEWORD( sid->IdentifierAuthority.Value[3],
sid->IdentifierAuthority.Value[2] )));
for (i = 0; i < sid->SubAuthorityCount; i++)
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->SubAuthority[i] );
p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->SubAuthority[i] );
len = (p + 1 - buffer) * sizeof(WCHAR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment