30#define KEY "ProfileInt"
32#define TESTFILE ".\\testwine.ini"
33#define TESTFILE2 ".\\testwine2.ini"
37 char value[200] = {0};
42#define check_profile_string(a, b, c, d) check_profile_string_(__LINE__, a, b, c, d);
88 for (
i=0;
i < num_test;
i++) {
95 ok((
res == profileInt[
i].
result),
"test<%02d>: ret<%010u> exp<%010u>\n",
101 ok((
res == profileInt[
i].
result),
"test<%02d>: ret<%010u> exp<%010u>\n",
111 static const WCHAR keyW[] = {
'k',
'e',
'y',0 };
112 static const WCHAR sW[] = {
's',0 };
113 static const WCHAR TESTFILE2W[] = {
'.',
'\\',
't',
'e',
's',
't',
'w',
'i',
'n',
'e',
'2',
'.',
'i',
'n',
'i',0};
114 static const WCHAR valsectionW[] = {
'v',
'a',
'l',
'_',
'e',
'_',
's',
'e',
'c',
't',
'i',
'o',
'n',0 };
115 static const WCHAR valnokeyW[] = {
'v',
'a',
'l',
'_',
'n',
'o',
'_',
'k',
'e',
'y',0};
124 char content[]=
"[s]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n";
125 char content2[]=
"\r\nkey=val_no_section\r\n[]\r\nkey=val_e_section\r\n"
126 "[s]\r\n=val_no_key\r\n[t]\r\n";
141 ok(
ret == 18 && !
strcmp(
buf,
"name1,name2,name4"),
"wrong keys returned(%d): %s\n",
ret,
150 ok(
ret == 24 && !
strcmp(
buf,
"name1,name2,name4,name5"),
"wrong keys returned(%d): %s\n",
163 ok(
ret == 13,
"expected 13, got %u\n",
ret);
165 ok(!
lstrcmpW(valsectionW,bufW),
"expected %s, got %s\n",
170 ok(
ret == 10,
"expected 10, got %u\n",
ret);
171 ok(!
lstrcmpW(valnokeyW,bufW),
"expected %s, got %s\n",
184 static const char content[]=
"[section1]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n[section2]\r\n[section3]\r\n=val5\r\n";
185 static const char testfile4[]=
".\\testwine4.ini";
198 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
201 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
206 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
209 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
215 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
221 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
223 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
227 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
230 "expected ERROR_FILE_NOT_FOUND, got %ld\n",
GetLastError());
235 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
244 ok(
ret == 35 && !
strcmp(
buf,
"name1=val1,name2=,name3,name4=val4"),
"wrong section returned(%d): %s\n",
246 ok(
buf[
ret-1] == 0 &&
buf[
ret] == 0,
"returned buffer not terminated with double-null\n" );
253 trace(
"section3 return: %s\n",
buf);
256 ok(
ret == 6 && !
strcmp(
buf,
"=val5"),
"wrong section returned(%d): %s\n",
258 ok(
buf[
ret-1] == 0 &&
buf[
ret] == 0,
"returned buffer not terminated with double-null\n" );
266 ok(
ret == 22 && !
strcmp(
buf,
"name1=val1,name2=,name"),
"wrong section returned(%d): %s\n",
268 ok(
buf[
ret] == 0 &&
buf[
ret+1] == 0,
"returned buffer not terminated with double-null\n" );
280 static const char content[]=
"[ section1 ]\r\n[section2]\r\n[section3]\r\n";
281 static const char testfile3[]=
".\\testwine3.ini";
282 static const WCHAR testfile3W[]={
'.',
'\\',
't',
'e',
's',
't',
'w',
'i',
'n',
'e',
'3',
'.',
'i',
'n',
'i',0 };
283 static const WCHAR not_here[] = {
'.',
'\\',
'n',
'o',
't',
'_',
'h',
'e',
'r',
'e',
'.',
'i',
'n',
'i',0};
295 ok(
ret == 27,
"expected return size 27, got %d\n",
ret );
297 "returned buffer not terminated with double-null\n" );
303 ok(
ret == 26,
"expected return size 26, got %d\n",
ret );
307 "returned buffer not terminated with double-null\n" );
312 ok(
ret == 25,
"expected return size 25, got %d\n",
ret );
316 "returned buffer not terminated with double-null\n" );
321 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
322 ok(
buf[0] == 0,
"returned buffer not terminated with null\n" );
323 ok(
buf[1] != 0,
"returned buffer terminated with double-null\n" );
327 memset(bufW, 0xcc,
sizeof(bufW));
331 win_skip(
"GetPrivateProfileSectionNamesW is not implemented\n");
335 ok(
ret == 27,
"expected return size 27, got %d\n",
ret );
336 ok( bufW[
ret-1] == 0 && bufW[
ret] == 0,
"returned buffer not terminated with double-null\n" );
339 memset(bufW, 0xcc,
sizeof(bufW));
341 ok(
ret == 26,
"expected return size 26, got %d\n",
ret );
342 ok( (bufW[
ret+1] == 0 && bufW[
ret] == 0) ||
344 "returned buffer not terminated with double-null\n" );
347 memset(bufW, 0xcc,
sizeof(bufW));
349 ok(
ret == 25,
"expected return size 25, got %d\n",
ret );
350 ok( bufW[
ret+1] == 0 && bufW[
ret] == 0,
"returned buffer not terminated with double-null\n" );
355 memset(bufW, 0xcc,
sizeof(bufW));
357 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
358 ok( bufW[0] == 0,
"returned buffer not terminated with null\n" );
359 ok( bufW[1] != 0,
"returned buffer terminated with double-null\n" );
365 static const char *testfile1 =
".\\winesharing1.ini";
366 static const char *testfile2 =
".\\winesharing2.ini";
368 static const struct {
369 DWORD dwDesiredAccess;
401 if (!pe[
i].write_error)
405 "%d: WritePrivateProfileString failed with error %lu\n",
i,
GetLastError() );
409 ok(
size == 5,
"%d: test failed, number of characters copied: %ld instead of 5\n",
i,
size );
411 ok( !
size,
"%d: test failed, number of characters copied: %ld instead of 0\n",
i,
size );
416 ok( !
ret,
"%d: WritePrivateProfileString succeeded\n",
i );
418 ok(
err == pe[
i].write_error,
"%d: WritePrivateProfileString failed with error %lu/%lu\n",
419 i,
err, pe[
i].write_error );
422 ok( !
size,
"%d: test failed, number of characters copied: %ld instead of 0\n",
i,
size );
440 if (!pe[
i].read_error)
443 ok( !
ret,
"%d: GetPrivateProfileString succeeded\n",
i );
453 static const CHAR testfile[] =
".\\testwine5.ini";
464 ok(
res == 123,
"Got %ld instead of 123\n",
res);
472 static const CHAR testfile[] =
".\\winetest4.ini";
475 static const char contents1[] =
"[" SECTION "]\n" KEY "=123\n";
476 static const char contents2[] =
"[" SECTION "]\n" KEY "=124\n";
482 ok(
size ==
sizeof contents1 - 1,
"Test file: partial write\n");
486 ok(
res == 123,
"Got %ld instead of 123\n",
res);
496 ok(
size ==
sizeof contents2 - 1,
"Test file: partial write\n");
500 ok(
res == 124,
"Got %ld instead of 124\n",
res);
508 ok(
res == 421,
"Got %ld instead of 421\n",
res);
529 trace(
"emptystr[%d] = %d\n",
i,emptystr[
i]);
541 const char *sddl_string_everyone_readonly =
"D:PAI(A;;0x1200a9;;;WD)";
543 char lpStruct[] = {
's',
't',
'r',
'i',
'n',
'g' };
545 attributes.
nLength =
sizeof(attributes);
547 ok(
ret ==
TRUE,
"ConvertStringSecurityDescriptorToSecurityDescriptor failed: %ld\n",
GetLastError());
552 strcpy(path_file, path_folder);
585 static const char filename[] =
".\\winetest.ini";
587 trace(
"test_GetPrivateProfileStringA: %s\n", descript);
600 ok(
ret == 18,
"Expected 18, got %ld\n",
ret);
604 "Expected \"section1\\x00section2\\x00\\x00\", got %s\n",
612 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
621 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
629 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
638 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
649 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
660 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
669 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
678 ok(
ret == 18,
"Expected 18, got %ld\n",
ret);
680 "Expected \"name1\\x00name2\\x00name4\\x00\\x00\", got %s\n",
688 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
697 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
705 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
714 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
725 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
741 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
749 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
757 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
765 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
766 ok(!
lstrcmpA(
buf,
"kumquat"),
"Expected buf to be unchanged, got \"%s\"\n",
buf);
773 ok(
ret == 3,
"Expected 3, got %ld\n",
ret);
781 ok(
ret == 4,
"Expected 4, got %ld\n",
ret);
789 ok(
ret == 1,
"Expected 1, got %ld\n",
ret);
797 ok(
ret == 0,
"Expected 0, got %ld\n",
ret);
805 ok(
ret == 14,
"Expected 14, got %ld\n",
ret);
809 "Expected \"section1\\x00secti\\x00\\x00\", got %s\n",
817 ok(
ret == 14,
"Expected 14, got %ld\n",
ret);
820 "Expected \"name1\\x00name2\\x00na\\x00\\x00\", got %s\n",
828 ok(
ret == 4,
"Expected 4, got %ld\n",
ret);
836 ok(
ret == 4,
"Expected 4, got %ld\n",
ret);
844 ok(
ret == 7,
"Expected 7, got %ld\n",
ret);
852 skip(
"Not allowed to create a file in the Windows directory\n");
864 ok(
ret == 4,
"Expected 4, got %ld\n",
ret);
872 ok(
ret == 4,
"Expected 4, got %ld\n",
ret);
880 ok(
ret == 0,
"expected return size 0, got %ld\n",
ret );
885 "expected 0xdeadbeef or ERROR_FILE_NOT_FOUND, got %ld\n",
GetLastError());
940 "Expected ERROR_FILE_NOT_FOUND, got %ld\n",
GetLastError());
942 "Expected path to not exist\n");
952 "Expected ERROR_FILE_NOT_FOUND, got %ld\n",
GetLastError());
1014 "Expected ERROR_ACCESS_DENIED, got %ld\n",
GetLastError());
1021 skip(
"Not allowed to create a file in the Windows directory\n");
1098 data =
"[App3]\r\n";
1105 data =
"Data \0 before \0 first \0 section"
1106 "\r\n[section1]\r\n"
1119 static const char expect_data[] =
"[s]\r\nkey=616261637573006F\r\n";
1120 static const char expect_data_empty[] =
"[s]\r\n";
1126 ok(!
ret,
"expected failure\n");
1135 ok(!
ret,
"expected failure\n");
1140 ok(!
ret,
"expected failure\n");
1150 ok(
ret == 16,
"got size %u\n",
ret);
1158 ok(!
ret,
"expected failure\n");
1174 ok(!
ret,
"expected failure\n");
1182 ok(!
ret,
"expected failure\n");
1188 ok(
FALSE,
"FIXME: Deleting private profile struct crashes on ReactOS!\n");
1193 ok(
check_file_data(
"./winetest.ini", expect_data_empty),
"file doesn't match\n");
1214#define check_registry_value(a, b, c) check_registry_value_(__LINE__, a, b, c)
1218 static const DWORD ivalue = 0xabacab;
1219 HKEY mapping_key, mapped_key, mapping_subkey;
1228 if (*
p ==
'\\') *
p =
'/';
1238 "Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\winetest_map.ini",
1242 skip(
"Not enough permissions to write to the IniFileMapping key.\n");
1653 ok(!
ret,
"expected failure\n");
1672 "name2=\"val2\"\r\n"
#define RegCloseKey(hKey)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
BOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
static __inline const char * debugstr_an(const char *s, int n)
#define FILE_ATTRIBUTE_NORMAL
#define ERROR_ACCESS_DENIED
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR buffer, DWORD size, LPCWSTR filename)
INT WINAPI GetPrivateProfileSectionA(LPCSTR section, LPSTR buffer, DWORD len, LPCSTR filename)
BOOL WINAPI WritePrivateProfileStructA(LPCSTR section, LPCSTR key, LPVOID buf, UINT bufsize, LPCSTR filename)
BOOL WINAPI WritePrivateProfileSectionA(LPCSTR section, LPCSTR string, LPCSTR filename)
INT WINAPI GetPrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR def_val, LPSTR buffer, UINT len, LPCSTR filename)
DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR buffer, DWORD size, LPCSTR filename)
UINT WINAPI GetPrivateProfileIntA(LPCSTR section, LPCSTR entry, INT def_val, LPCSTR filename)
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
BOOL WINAPI GetPrivateProfileStructA(LPCSTR section, LPCSTR key, LPVOID buffer, UINT len, LPCSTR filename)
BOOL WINAPI DECLSPEC_HOTPATCH WritePrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR string, LPCSTR filename)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
BOOL WINAPI RevertToSelf(void)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP char *__cdecl strrchr(const char *, int)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
HLOCAL NTAPI LocalFree(HLOCAL hMem)
static const WCHAR emptyW[]
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
#define FILE_FLAG_DELETE_ON_CLOSE
#define ERROR_FILE_NOT_FOUND
static BOOL check_file_data(LPCSTR path, LPCSTR data)
static void check_profile_string_(int line, const char *section, const char *name, const char *file, const char *expect)
#define check_profile_string(a, b, c, d)
static void check_registry_value_(int line, HKEY key, const char *value, const char *expect)
static void test_profile_string(void)
static void test_profile_existing(void)
#define check_registry_value(a, b, c)
static void test_GetPrivateProfileString(const char *content, const char *descript)
static void test_WritePrivateProfileString(void)
static void create_test_file(LPCSTR name, LPCSTR data, DWORD size)
static void test_profile_int(void)
static void test_profile_struct(void)
static BOOL emptystr_ok(CHAR emptystr[MAX_PATH])
static void test_profile_refresh(void)
static void test_profile_delete_on_close(void)
static void test_registry_mapping(void)
static void test_profile_sections_names(void)
static void test_profile_directory_readonly(void)
static BOOL check_binary_file_data(LPCSTR path, const VOID *data, DWORD size)
static void test_profile_sections(void)
static const char * contents
LPVOID lpSecurityDescriptor
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define ERROR_SHARING_VIOLATION
#define ERROR_INVALID_DATA
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER