"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/kernel32/profile.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

profile.c  (wine-5.12.tar.xz):profile.c  (wine-5.13.tar.xz)
skipping to change at line 32 skipping to change at line 32
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "winerror.h" #include "winerror.h"
#include "winreg.h"
#include "winternl.h" #include "winternl.h"
#include "shlwapi.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/library.h" #include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(profile); WINE_DEFAULT_DEBUG_CHANNEL(profile);
static const char bom_utf8[] = {0xEF,0xBB,0xBF}; static const char bom_utf8[] = {0xEF,0xBB,0xBF};
typedef enum typedef enum
{ {
skipping to change at line 1008 skipping to change at line 1010
HeapFree( GetProcessHeap(), 0, key->value ); HeapFree( GetProcessHeap(), 0, key->value );
} }
else TRACE(" creating key\n" ); else TRACE(" creating key\n" );
key->value = HeapAlloc( GetProcessHeap(), 0, (strlenW(value)+1) * sizeof (WCHAR) ); key->value = HeapAlloc( GetProcessHeap(), 0, (strlenW(value)+1) * sizeof (WCHAR) );
strcpyW( key->value, value ); strcpyW( key->value, value );
CurProfile->changed = TRUE; CurProfile->changed = TRUE;
} }
return TRUE; return TRUE;
} }
static HKEY open_file_mapping_key( const WCHAR *filename )
{
static const WCHAR mapping_pathW[] = {'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',
'\\','I','n','i','F','i','l','e','M','a','p','p','i','n','g',0};
static HKEY mapping_key;
HKEY key;
EnterCriticalSection( &PROFILE_CritSect );
if (!mapping_key && RegOpenKeyExW( HKEY_LOCAL_MACHINE, mapping_pathW, 0, KEY
_WOW64_64KEY, &mapping_key ))
mapping_key = NULL;
LeaveCriticalSection( &PROFILE_CritSect );
if (mapping_key && !RegOpenKeyExW( mapping_key, PathFindFileNameW( filename
), 0, KEY_READ, &key ))
return key;
return NULL;
}
static WCHAR *enum_key( HKEY key, DWORD i )
{
WCHAR *value, *new_value;
DWORD max = 256, len;
LSTATUS res;
if (!(value = HeapAlloc( GetProcessHeap(), 0, max * sizeof(WCHAR) ))) return
NULL;
len = max;
while ((res = RegEnumValueW( key, i, value, &len, NULL, NULL, NULL, NULL ))
== ERROR_MORE_DATA)
{
max *= 2;
if (!(new_value = HeapReAlloc( GetProcessHeap(), 0, value, max * sizeof(
WCHAR) )))
{
HeapFree( GetProcessHeap(), 0, value );
return NULL;
}
value = new_value;
len = max;
}
if (!res) return value;
HeapFree( GetProcessHeap(), 0, value );
return NULL;
}
static WCHAR *get_key_value( HKEY key, const WCHAR *value )
{
DWORD size = 0;
WCHAR *data;
if (RegGetValueW( key, NULL, value, RRF_RT_REG_SZ | RRF_NOEXPAND, NULL, NULL
, &size )) return NULL;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL;
if (!RegGetValueW( key, NULL, value, RRF_RT_REG_SZ | RRF_NOEXPAND, NULL, (BY
TE *)data, &size )) return data;
HeapFree( GetProcessHeap(), 0, data );
return NULL;
}
static HKEY open_mapped_key( const WCHAR *path, BOOL write )
{
static const WCHAR softwareW[] = {'S','o','f','t','w','a','r','e','\\',0};
static const WCHAR usrW[] = {'U','S','R',':'};
static const WCHAR sysW[] = {'S','Y','S',':'};
WCHAR *combined_path;
const WCHAR *p;
LSTATUS res;
HKEY key;
TRACE("%s\n", debugstr_w( path ));
for (p = path; strchr("!#@", *p); p++)
FIXME("ignoring %c modifier\n", *p);
if (!strncmpW( p, usrW, ARRAY_SIZE( usrW ) ))
{
if (write)
res = RegCreateKeyExW( HKEY_CURRENT_USER, p + 4, 0, NULL, 0, KEY_REA
D | KEY_WRITE, NULL, &key, NULL );
else
res = RegOpenKeyExW( HKEY_CURRENT_USER, p + 4, 0, KEY_READ, &key );
return res ? NULL : key;
}
if (!strncmpW( p, sysW, ARRAY_SIZE( sysW ) ))
{
p += 4;
if (!(combined_path = HeapAlloc( GetProcessHeap(), 0,
(ARRAY_SIZE( softwareW ) + strlenW( p )
) * sizeof(WCHAR) )))
return NULL;
strcpyW( combined_path, softwareW );
strcatW( combined_path, p );
if (write)
res = RegCreateKeyExW( HKEY_LOCAL_MACHINE, combined_path, 0, NULL,
0, KEY_READ | KEY_WRITE, NULL, &key, NULL );
else
res = RegOpenKeyExW( HKEY_LOCAL_MACHINE, combined_path, 0, KEY_READ,
&key );
HeapFree( GetProcessHeap(), 0, combined_path );
return res ? NULL : key;
}
FIXME("unhandled path syntax %s\n", debugstr_w( path ));
return NULL;
}
/* returns TRUE if the given section + name is mapped */
static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section,
const WCHAR *name, BOOL write, HKEY *ret_key
)
{
static const WCHAR backslashW[] = {'\\',0};
WCHAR *path = NULL, *combined_path;
HKEY key, subkey = NULL;
if (!(key = open_file_mapping_key( filename )))
return FALSE;
if (!RegOpenKeyExW( key, section, 0, KEY_READ, &subkey ))
{
if (!(path = get_key_value( subkey, name )))
path = get_key_value( subkey, NULL );
RegCloseKey( subkey );
RegCloseKey( key );
if (!path) return FALSE;
}
else
{
if (!(path = get_key_value( key, section )))
{
if ((path = get_key_value( key, NULL )))
{
if ((combined_path = HeapAlloc( GetProcessHeap(), 0,
(strlenW( path ) + strlenW( sect
ion ) + 2) * sizeof(WCHAR) )))
{
strcpyW( combined_path, path );
strcatW( combined_path, backslashW );
strcatW( combined_path, section );
}
HeapFree( GetProcessHeap(), 0, path );
path = combined_path;
}
}
RegCloseKey( key );
if (!path) return FALSE;
}
*ret_key = open_mapped_key( path, write );
HeapFree( GetProcessHeap(), 0, path );
return TRUE;
}
static DWORD get_mapped_section( HKEY key, WCHAR *buffer, DWORD size, BOOL retur
n_values )
{
WCHAR *entry, *value;
DWORD i, ret = 0;
for (i = 0; (entry = enum_key( key, i )); ++i)
{
lstrcpynW( buffer + ret, entry, size - ret - 1 );
ret = min( ret + strlenW( entry ) + 1, size - 1 );
if (return_values && ret < size - 1 && (value = get_key_value( key, entr
y )))
{
buffer[ret - 1] = '=';
lstrcpynW( buffer + ret, value, size - ret - 1 );
ret = min( ret + strlenW( value ) + 1, size - 1 );
HeapFree( GetProcessHeap(), 0, value );
}
HeapFree( GetProcessHeap(), 0, entry );
}
return ret;
}
static DWORD get_section( const WCHAR *filename, const WCHAR *section,
WCHAR *buffer, DWORD size, BOOL return_values )
{
HKEY key, subkey, section_key;
BOOL use_ini = TRUE;
DWORD ret = 0;
WCHAR *path;
if ((key = open_file_mapping_key( filename )))
{
if (!RegOpenKeyExW( key, section, 0, KEY_READ, &subkey ))
{
WCHAR *entry, *value;
HKEY entry_key;
DWORD i;
for (i = 0; (entry = enum_key( subkey, i )); ++i)
{
if (!(path = get_key_value( subkey, entry )))
{
HeapFree( GetProcessHeap(), 0, entry );
continue;
}
entry_key = open_mapped_key( path, FALSE );
HeapFree( GetProcessHeap(), 0, path );
if (!entry_key)
{
HeapFree( GetProcessHeap(), 0, entry );
continue;
}
if (entry[0])
{
if ((value = get_key_value( entry_key, entry )))
{
lstrcpynW( buffer + ret, entry, size - ret - 1 );
ret = min( ret + strlenW( entry ) + 1, size - 1 );
if (return_values && ret < size - 1)
{
buffer[ret - 1] = '=';
lstrcpynW( buffer + ret, value, size - ret - 1 );
ret = min( ret + strlenW( value ) + 1, size - 1 );
}
HeapFree( GetProcessHeap(), 0, value );
}
}
else
{
ret = get_mapped_section( entry_key, buffer, size, return_va
lues );
use_ini = FALSE;
}
HeapFree( GetProcessHeap(), 0, entry );
RegCloseKey( entry_key );
}
RegCloseKey( subkey );
}
else if (get_mapped_section_key( filename, section, NULL, FALSE, &sectio
n_key ))
{
ret = get_mapped_section( section_key, buffer, size, return_values )
;
use_ini = FALSE;
RegCloseKey( section_key );
}
RegCloseKey( key );
}
if (use_ini)
ret += PROFILE_GetSection( filename, section, buffer + ret, size - ret,
return_values );
return ret;
}
static void delete_key_values( HKEY key )
{
WCHAR *entry;
while ((entry = enum_key( key, 0 )))
{
RegDeleteValueW( key, entry );
HeapFree( GetProcessHeap(), 0, entry );
}
}
static BOOL delete_section( const WCHAR *filename, const WCHAR *section )
{
HKEY key, subkey, section_key;
if ((key = open_file_mapping_key( filename )))
{
if (!RegOpenKeyExW( key, section, 0, KEY_READ, &subkey ))
{
WCHAR *entry, *path;
HKEY entry_key;
DWORD i;
for (i = 0; (entry = enum_key( subkey, i )); ++i)
{
if (!(path = get_key_value( subkey, entry )))
{
HeapFree( GetProcessHeap(), 0, path );
continue;
}
entry_key = open_mapped_key( path, TRUE );
HeapFree( GetProcessHeap(), 0, path );
if (!entry_key)
{
HeapFree( GetProcessHeap(), 0, entry );
continue;
}
if (entry[0])
RegDeleteValueW( entry_key, entry );
else
delete_key_values( entry_key );
HeapFree( GetProcessHeap(), 0, entry );
RegCloseKey( entry_key );
}
RegCloseKey( subkey );
}
else if (get_mapped_section_key( filename, section, NULL, TRUE, &section
_key ))
{
delete_key_values( section_key );
RegCloseKey( section_key );
}
RegCloseKey( key );
}
return PROFILE_DeleteSection( filename, section );
}
/********************* API functions **********************************/ /********************* API functions **********************************/
/*********************************************************************** /***********************************************************************
* GetProfileIntA (KERNEL32.@) * GetProfileIntA (KERNEL32.@)
*/ */
UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val ) UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val )
{ {
return GetPrivateProfileIntA( section, entry, def_val, "win.ini" ); return GetPrivateProfileIntA( section, entry, def_val, "win.ini" );
} }
skipping to change at line 1037 skipping to change at line 1346
* GetPrivateProfileStringW (KERNEL32.@) * GetPrivateProfileStringW (KERNEL32.@)
*/ */
INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, LPCWSTR def_val, LPWSTR buffer,
UINT len, LPCWSTR filename ) UINT len, LPCWSTR filename )
{ {
static const WCHAR emptyW[] = {0}; static const WCHAR emptyW[] = {0};
int ret; int ret;
LPWSTR defval_tmp = NULL; LPWSTR defval_tmp = NULL;
const WCHAR *p; const WCHAR *p;
HKEY key;
TRACE("%s,%s,%s,%p,%u,%s\n", debugstr_w(section), debugstr_w(entry), TRACE("%s,%s,%s,%p,%u,%s\n", debugstr_w(section), debugstr_w(entry),
debugstr_w(def_val), buffer, len, debugstr_w(filename)); debugstr_w(def_val), buffer, len, debugstr_w(filename));
if (!buffer || !len) return 0; if (!buffer || !len) return 0;
if (!def_val) def_val = emptyW; if (!def_val) def_val = emptyW;
if (!section) return GetPrivateProfileSectionNamesW( buffer, len, filename ) ; if (!section) return GetPrivateProfileSectionNamesW( buffer, len, filename ) ;
if (!entry) if (!entry)
{ {
ret = PROFILE_GetSection( filename, section, buffer, len, FALSE ); ret = get_section( filename, section, buffer, len, FALSE );
if (!buffer[0]) if (!buffer[0])
{ {
PROFILE_CopyEntry( buffer, def_val, len ); PROFILE_CopyEntry( buffer, def_val, len );
ret = strlenW( buffer ); ret = strlenW( buffer );
} }
return ret; return ret;
} }
/* strip any trailing ' ' of def_val. */ /* strip any trailing ' ' of def_val. */
p = def_val + strlenW(def_val) - 1; p = def_val + strlenW(def_val) - 1;
skipping to change at line 1070 skipping to change at line 1380
if (p >= def_val) if (p >= def_val)
{ {
int vlen = (int)(p - def_val) + 1; int vlen = (int)(p - def_val) + 1;
defval_tmp = HeapAlloc(GetProcessHeap(), 0, (vlen + 1) * sizeof(WCHAR)); defval_tmp = HeapAlloc(GetProcessHeap(), 0, (vlen + 1) * sizeof(WCHAR));
memcpy(defval_tmp, def_val, vlen * sizeof(WCHAR)); memcpy(defval_tmp, def_val, vlen * sizeof(WCHAR));
defval_tmp[vlen] = '\0'; defval_tmp[vlen] = '\0';
def_val = defval_tmp; def_val = defval_tmp;
} }
RtlEnterCriticalSection( &PROFILE_CritSect ); if (get_mapped_section_key( filename, section, entry, FALSE, &key ))
if (PROFILE_Open( filename, FALSE ))
{ {
PROFILEKEY *key = PROFILE_Find( &CurProfile->section, section, entry, FA if (key)
LSE, FALSE ); {
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val, l WCHAR *value;
en );
TRACE("-> %s\n", debugstr_w( buffer )); if ((value = get_key_value( key, entry )))
{
lstrcpynW( buffer, value, len );
HeapFree( GetProcessHeap(), 0, value );
}
else
lstrcpynW( buffer, def_val, len );
RegCloseKey( key );
}
else
lstrcpynW( buffer, def_val, len );
ret = strlenW( buffer ); ret = strlenW( buffer );
} }
else else
{ {
lstrcpynW( buffer, def_val, len ); EnterCriticalSection( &PROFILE_CritSect );
ret = strlenW( buffer );
}
RtlLeaveCriticalSection( &PROFILE_CritSect ); if (PROFILE_Open( filename, FALSE ))
{
PROFILEKEY *key = PROFILE_Find( &CurProfile->section, section, entry
, FALSE, FALSE );
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_va
l, len );
TRACE("-> %s\n", debugstr_w( buffer ));
ret = strlenW( buffer );
}
else
{
lstrcpynW( buffer, def_val, len );
ret = strlenW( buffer );
}
LeaveCriticalSection( &PROFILE_CritSect );
}
HeapFree(GetProcessHeap(), 0, defval_tmp); HeapFree(GetProcessHeap(), 0, defval_tmp);
TRACE("returning %s, %d\n", debugstr_w(buffer), ret); TRACE("returning %s, %d\n", debugstr_w(buffer), ret);
return ret; return ret;
} }
/*********************************************************************** /***********************************************************************
* GetPrivateProfileStringA (KERNEL32.@) * GetPrivateProfileStringA (KERNEL32.@)
skipping to change at line 1239 skipping to change at line 1573
DWORD len, LPCWSTR filename ) DWORD len, LPCWSTR filename )
{ {
if (!section || !buffer) if (!section || !buffer)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(fil ename)); TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(fil ename));
return PROFILE_GetSection( filename, section, buffer, len, TRUE ); return get_section( filename, section, buffer, len, TRUE );
} }
/*********************************************************************** /***********************************************************************
* GetPrivateProfileSectionA (KERNEL32.@) * GetPrivateProfileSectionA (KERNEL32.@)
*/ */
INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer, INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
DWORD len, LPCSTR filename ) DWORD len, LPCSTR filename )
{ {
UNICODE_STRING sectionW, filenameW; UNICODE_STRING sectionW, filenameW;
LPWSTR bufferW; LPWSTR bufferW;
skipping to change at line 1311 skipping to change at line 1645
return GetPrivateProfileSectionW( section, buffer, len, wininiW ); return GetPrivateProfileSectionW( section, buffer, len, wininiW );
} }
/*********************************************************************** /***********************************************************************
* WritePrivateProfileStringW (KERNEL32.@) * WritePrivateProfileStringW (KERNEL32.@)
*/ */
BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry, BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR string, LPCWSTR filename ) LPCWSTR string, LPCWSTR filename )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
HKEY key;
TRACE("(%s, %s, %s, %s)\n", debugstr_w(section), debugstr_w(entry), debugstr
_w(string), debugstr_w(filename));
if (!section && !entry && !string) /* documented "file flush" case */ if (!section && !entry && !string) /* documented "file flush" case */
{ {
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (!filename || PROFILE_Open( filename, TRUE )) if (!filename || PROFILE_Open( filename, TRUE ))
{ {
if (CurProfile) PROFILE_ReleaseFile(); if (CurProfile) PROFILE_ReleaseFile();
} }
LeaveCriticalSection( &PROFILE_CritSect ); LeaveCriticalSection( &PROFILE_CritSect );
return FALSE; return FALSE;
} }
if (!entry) return PROFILE_DeleteSection( filename, section ); if (!entry) return delete_section( filename, section );
if (get_mapped_section_key( filename, section, entry, TRUE, &key ))
{
LSTATUS res;
if (string)
res = RegSetValueExW( key, entry, 0, REG_SZ, (const BYTE *)string,
(strlenW( string ) + 1) * sizeof(WCHAR) );
else
res = RegDeleteValueW( key, entry );
RegCloseKey( key );
if (res) SetLastError( res );
return !res;
}
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename, TRUE )) if (PROFILE_Open( filename, TRUE ))
{ {
if (!section) if (!section)
SetLastError(ERROR_FILE_NOT_FOUND); SetLastError(ERROR_FILE_NOT_FOUND);
else else
ret = PROFILE_SetString( section, entry, string, FALSE); ret = PROFILE_SetString( section, entry, string, FALSE);
if (ret) ret = PROFILE_FlushFile(); if (ret) ret = PROFILE_FlushFile();
skipping to change at line 1374 skipping to change at line 1725
} }
/*********************************************************************** /***********************************************************************
* WritePrivateProfileSectionW (KERNEL32.@) * WritePrivateProfileSectionW (KERNEL32.@)
*/ */
BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section, BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section,
LPCWSTR string, LPCWSTR filename ) LPCWSTR string, LPCWSTR filename )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
LPWSTR p; LPWSTR p;
HKEY key, section_key;
if (!section && !string) if (!section && !string)
{ {
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (!filename || PROFILE_Open( filename, TRUE )) if (!filename || PROFILE_Open( filename, TRUE ))
{ {
if (CurProfile) PROFILE_ReleaseFile(); if (CurProfile) PROFILE_ReleaseFile();
} }
LeaveCriticalSection( &PROFILE_CritSect ); LeaveCriticalSection( &PROFILE_CritSect );
return FALSE; return FALSE;
} }
if (!string) return PROFILE_DeleteSection( filename, section ); if (!string) return delete_section( filename, section );
if ((key = open_file_mapping_key( filename )))
{
/* replace existing entries, but only if they are mapped, and do not
* delete any keys */
const WCHAR *entry, *p;
for (entry = string; *entry; entry += strlenW( entry ) + 1)
{
if ((p = strchrW( entry, '=' )))
{
WCHAR *entry_copy;
p++;
if (!(entry_copy = HeapAlloc( GetProcessHeap(), 0, (p - entry) *
sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
RegCloseKey( key );
return FALSE;
}
lstrcpynW( entry_copy, entry, p - entry );
if (get_mapped_section_key( filename, section, entry_copy, TRUE,
&section_key ))
{
LSTATUS res = RegSetValueExW( section_key, entry_copy, 0, RE
G_SZ, (const BYTE *)p,
(strlenW( p ) + 1) * sizeof(WC
HAR) );
RegCloseKey( section_key );
if (res)
{
SetLastError( res );
RegCloseKey( key );
return FALSE;
}
}
}
}
RegCloseKey( key );
return TRUE;
}
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename, TRUE )) if (PROFILE_Open( filename, TRUE ))
{ {
PROFILE_DeleteAllKeys(section); PROFILE_DeleteAllKeys(section);
ret = TRUE; ret = TRUE;
while (*string && ret) while (*string && ret)
{ {
WCHAR *buf = HeapAlloc( GetProcessHeap(), 0, (strlenW( string ) + 1) * sizeof(WCHAR) ); WCHAR *buf = HeapAlloc( GetProcessHeap(), 0, (strlenW( string ) + 1) * sizeof(WCHAR) );
skipping to change at line 1506 skipping to change at line 1896
* *
* Wine implements the observed Win2000 behavior (except for the bug). * Wine implements the observed Win2000 behavior (except for the bug).
* *
* Note that when the buffer is big enough then the return value may be any * Note that when the buffer is big enough then the return value may be any
* value between 1 and len-1 (or len in Win95), including len-2. * value between 1 and len-1 (or len in Win95), including len-2.
*/ */
DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size, DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size,
LPCWSTR filename) LPCWSTR filename)
{ {
DWORD ret = 0; DWORD ret = 0;
HKEY key;
if ((key = open_file_mapping_key( filename )))
{
WCHAR *section;
DWORD i;
for (i = 0; (section = enum_key( key, i )); ++i)
{
lstrcpynW( buffer + ret, section, size - ret - 1 );
ret = min( ret + strlenW( section ) + 1, size - 1 );
}
RegCloseKey( key );
}
RtlEnterCriticalSection( &PROFILE_CritSect ); RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename, FALSE )) if (PROFILE_Open( filename, FALSE ))
ret = PROFILE_GetSectionNames(buffer, size); ret += PROFILE_GetSectionNames( buffer + ret, size - ret );
RtlLeaveCriticalSection( &PROFILE_CritSect ); RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret; return ret;
} }
/*********************************************************************** /***********************************************************************
* GetPrivateProfileSectionNamesA (KERNEL32.@) * GetPrivateProfileSectionNamesA (KERNEL32.@)
*/ */
DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size, DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size,
 End of changes. 16 change blocks. 
17 lines changed or deleted 446 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)