30#define KEY "ProfileInt"
32#define TESTFILE ".\\testwine.ini"
33#define TESTFILE2 ".\\testwine2.ini"
74 int i, num_test = (
sizeof(profileInt)/
sizeof(
struct _profileInt));
79 for (
i=0;
i < num_test;
i++) {
87 "test<%02d>: ret<%010u> exp<%010u><%010u>\n",
97 static const WCHAR keyW[] = {
'k',
'e',
'y',0 };
98 static const WCHAR sW[] = {
's',0 };
99 static const WCHAR TESTFILE2W[] = {
'.',
'\\',
't',
'e',
's',
't',
'w',
'i',
'n',
'e',
'2',
'.',
'i',
'n',
'i',0};
100 static const WCHAR valsectionW[] = {
'v',
'a',
'l',
'_',
'e',
'_',
's',
'e',
'c',
't',
'i',
'o',
'n',0 };
101 static const WCHAR valnokeyW[] = {
'v',
'a',
'l',
'_',
'n',
'o',
'_',
'k',
'e',
'y',0};
110 char content[]=
"[s]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n";
111 char content2[]=
"\r\nkey=val_no_section\r\n[]\r\nkey=val_e_section\r\n"
112 "[s]\r\n=val_no_key\r\n[t]\r\n";
127 ok(
ret == 18 && !
strcmp(
buf,
"name1,name2,name4"),
"wrong keys returned(%d): %s\n",
ret,
136 ok(
ret == 24 && !
strcmp(
buf,
"name1,name2,name4,name5"),
"wrong keys returned(%d): %s\n",
148 sizeof(bufW)/
sizeof(bufW[0]), TESTFILE2W);
150 ok(
ret == 13,
"expected 13, got %u\n",
ret);
152 ok(!
lstrcmpW(valsectionW,bufW),
"expected %s, got %s\n",
157 sizeof(bufW)/
sizeof(bufW[0]), TESTFILE2W);
158 ok(
ret == 10,
"expected 10, got %u\n",
ret);
159 ok(!
lstrcmpW(valnokeyW,bufW),
"expected %s, got %s\n",
172 static const char content[]=
"[section1]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n[section2]\r\n";
173 static const char testfile4[]=
".\\testwine4.ini";
186 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
189 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
194 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
197 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
203 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
209 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
212 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
216 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
220 "expected ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
225 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
235 ok(
ret == 35 && !
strcmp(
buf,
"name1=val1,name2=,name3,name4=val4"),
"wrong section returned(%d): %s\n",
237 ok(
buf[
ret-1] == 0 &&
buf[
ret] == 0,
"returned buffer not terminated with double-null\n" );
246 ok(
ret == 22 && !
strcmp(
buf,
"name1=val1,name2=,name"),
"wrong section returned(%d): %s\n",
248 ok(
buf[
ret] == 0 &&
buf[
ret+1] == 0,
"returned buffer not terminated with double-null\n" );
260 static const char content[]=
"[section1]\r\n[section2]\r\n[section3]\r\n";
261 static const char testfile3[]=
".\\testwine3.ini";
262 static const WCHAR testfile3W[]={
'.',
'\\',
't',
'e',
's',
't',
'w',
'i',
'n',
'e',
'3',
'.',
'i',
'n',
'i',0 };
263 static const WCHAR not_here[] = {
'.',
'\\',
'n',
'o',
't',
'_',
'h',
'e',
'r',
'e',
'.',
'i',
'n',
'i',0};
277 "expected return size 27, got %d\n",
ret );
280 "returned buffer not terminated with double-null\n" );
287 "expected return size 26, got %d\n",
ret );
292 "returned buffer not terminated with double-null\n" );
297 ok(
ret == 25,
"expected return size 25, got %d\n",
ret );
303 "returned buffer not terminated with double-null\n" );
310 "expected return size 0, got %d\n",
ret );
311 ok(
buf[0] == 0,
"returned buffer not terminated with null\n" );
312 ok(
buf[1] != 0,
"returned buffer terminated with double-null\n" );
316 memset(bufW, 0xcc,
sizeof(bufW));
320 win_skip(
"GetPrivateProfileSectionNamesW is not implemented\n");
324 ok(
ret == 27,
"expected return size 27, got %d\n",
ret );
325 ok( bufW[
ret-1] == 0 && bufW[
ret] == 0,
"returned buffer not terminated with double-null\n" );
328 memset(bufW, 0xcc,
sizeof(bufW));
330 ok(
ret == 26,
"expected return size 26, got %d\n",
ret );
331 ok( (bufW[
ret+1] == 0 && bufW[
ret] == 0) ||
333 "returned buffer not terminated with double-null\n" );
336 memset(bufW, 0xcc,
sizeof(bufW));
338 ok(
ret == 25,
"expected return size 25, got %d\n",
ret );
339 ok( bufW[
ret+1] == 0 && bufW[
ret] == 0,
"returned buffer not terminated with double-null\n" );
344 memset(bufW, 0xcc,
sizeof(bufW));
346 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
347 ok( bufW[0] == 0,
"returned buffer not terminated with null\n" );
348 ok( bufW[1] != 0,
"returned buffer terminated with double-null\n" );
354 static const char *testfile1 =
".\\winesharing1.ini";
355 static const char *testfile2 =
".\\winesharing2.ini";
357 static const struct {
358 DWORD dwDesiredAccess;
382 for (
i=0;
i <
sizeof(pe)/
sizeof(pe[0]);
i++)
390 if (!pe[
i].write_error)
394 "%d: WritePrivateProfileString failed with error %u\n",
i,
GetLastError() );
398 ok(
size == 5,
"%d: test failed, number of characters copied: %d instead of 5\n",
i,
size );
400 ok( !
size,
"%d: test failed, number of characters copied: %d instead of 0\n",
i,
size );
405 ok( !
ret,
"%d: WritePrivateProfileString succeeded\n",
i );
407 ok(
err == pe[
i].write_error,
"%d: WritePrivateProfileString failed with error %u/%u\n",
408 i,
err, pe[
i].write_error );
411 ok( !
size,
"%d: test failed, number of characters copied: %d instead of 0\n",
i,
size );
422 for (
i=0;
i <
sizeof(pe)/
sizeof(pe[0]);
i++)
430 if (!pe[
i].read_error)
433 "%d: GetPrivateProfileString failed with error %u\n",
i,
GetLastError() );
435 ok( !
ret,
"%d: GetPrivateProfileString succeeded\n",
i );
445 static const CHAR testfile[] =
".\\testwine5.ini";
458 "Got %d instead of 123\n",
res);
466 static const CHAR testfile[] =
".\\winetest4.ini";
469 static const char contents1[] =
"[" SECTION "]\n" KEY "=123\n";
470 static const char contents2[] =
"[" SECTION "]\n" KEY "=124\n";
476 ok(
size ==
sizeof contents1 - 1,
"Test file: partial write\n");
482 "Got %d instead of 123\n",
res);
492 ok(
size ==
sizeof contents2 - 1,
"Test file: partial write\n");
498 "Got %d instead of 124\n",
res);
508 "Got %d 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);
552 strcpy(path_file, path_folder);
583 static const char filename[] =
".\\winetest.ini";
585 trace(
"test_GetPrivateProfileStringA: %s\n", descript);
594 win_skip(
"Win9x and WinME don't handle 'CR only' correctly\n");
612 "Expected 18, got %d\n",
ret);
615 "Expected \"section1\\0section2\\0\\0\", got \"%s\"\n",
buf);
622 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
631 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
639 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
642 "Expected \"\", got \"%s\"\n",
buf);
650 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
661 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
672 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
681 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
690 ok(
ret == 18,
"Expected 18, got %d\n",
ret);
692 "Expected \"name1\\0name2\\0name4\\0\", got \"%s\"\n",
buf);
699 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
708 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
716 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
719 "Expected \"\", got \"%s\"\n",
buf);
727 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
738 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
756 "Expected 7, got %d\n",
ret);
759 "Expected \"default\", got \"%s\"\n",
buf);
766 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
774 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
782 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
783 ok(!
lstrcmpA(
buf,
"kumquat"),
"Expected buf to be unchanged, got \"%s\"\n",
buf);
790 ok(
ret == 3,
"Expected 3, got %d\n",
ret);
798 ok(
ret == 4,
"Expected 4, got %d\n",
ret);
806 ok(
ret == 1,
"Expected 1, got %d\n",
ret);
814 ok(
ret == 0,
"Expected 0, got %d\n",
ret);
822 ok(
ret == 14,
"Expected 14, got %d\n",
ret);
827 "Expected \"section1\\0secti\\0\\0\", got \"%s\"\n",
buf);
834 ok(
ret == 14,
"Expected 14, got %d\n",
ret);
838 "Expected \"name1\\0name2\\0na\\0\\0\", got \"%s\"\n",
buf);
845 ok(
ret == 4,
"Expected 4, got %d\n",
ret);
853 ok(
ret == 4,
"Expected 4, got %d\n",
ret);
861 ok(
ret == 7,
"Expected 7, got %d\n",
ret);
869 skip(
"Not allowed to create a file in the Windows directory\n");
881 ok(
ret == 4,
"Expected 4, got %d\n",
ret);
889 ok(
ret == 4,
"Expected 4, got %d\n",
ret);
897 ok(
ret == 0,
"expected return size 0, got %d\n",
ret );
902 "expected 0xdeadbeef or ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
954 win_skip(
"WritePrivateProfileString on Win9x/WinME is hard to test reliably\n");
971 "Expected ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
973 "Expected path to not exist\n");
985 "Expected ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
1032 "File doesn't match\n");
1042 "Expected TRUE, got %d\n",
ret);
1045 "File doesn't match\n");
1054 "Expected ERROR_ACCESS_DENIED, got %d\n",
GetLastError());
1060 skip(
"Not allowed to create a file in the Windows directory\n");
1136 data =
"[App3]\r\n";
1143 data =
"Data \0 before \0 first \0 section"
1144 "\r\n[section1]\r\n"
1153 "Data \0 before \0 first \0 section"
1154 "\r\n\r\n[section1]\r\n"
1156 , 59)),
"File doesn't match\n");
1173 "name2=\"val2\"\r\n"
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
#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)
#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 WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR 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 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)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
GLuint GLuint GLsizei count
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
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
#define sprintf(buf, format,...)
static BOOL check_file_data(LPCSTR path, LPCSTR data)
static void test_profile_string(void)
static void test_profile_existing(void)
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 BOOL emptystr_ok(CHAR emptystr[MAX_PATH])
static void test_profile_refresh(void)
static void test_profile_delete_on_close(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
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
LPVOID lpSecurityDescriptor
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define ERROR_SHARING_VIOLATION
#define ERROR_PATH_NOT_FOUND