ReactOS 0.4.15-dev-8434-g155a7c7
GetProfileDirs.c File Reference
#include <apitest.h>
#include <userenv.h>
Include dependency graph for GetProfileDirs.c:

Go to the source code of this file.

Classes

struct  _GET_PROFILE_DIRS
 

Typedefs

typedef BOOL(WINAPIGET_PROFILE_DIRS_FUNC) (LPWSTR lpProfileDir, LPDWORD lpcchSize)
 
typedef struct _GET_PROFILE_DIRS GET_PROFILE_DIRS
 
typedef struct _GET_PROFILE_DIRSPGET_PROFILE_DIRS
 

Functions

 START_TEST (GetProfileDirs)
 

Variables

GET_PROFILE_DIRS GetProfileDirsFuncsList []
 

Typedef Documentation

◆ GET_PROFILE_DIRS

◆ GET_PROFILE_DIRS_FUNC

typedef BOOL(WINAPI * GET_PROFILE_DIRS_FUNC) (LPWSTR lpProfileDir, LPDWORD lpcchSize)

Definition at line 12 of file GetProfileDirs.c.

◆ PGET_PROFILE_DIRS

Function Documentation

◆ START_TEST()

START_TEST ( GetProfileDirs  )

Definition at line 28 of file GetProfileDirs.c.

29{
31 DWORD dwLastError;
32 DWORD cchSize;
33 WCHAR szProfileDir[MAX_PATH];
34
35 USHORT i;
36 PGET_PROFILE_DIRS GetProfileDirs;
37
38 for (i = 0; i < _countof(GetProfileDirsFuncsList); ++i)
39 {
40 GetProfileDirs = &GetProfileDirsFuncsList[i];
41
42 SetLastError(0xdeadbeef);
43 Success = GetProfileDirs->pFunc(NULL, NULL);
44 dwLastError = GetLastError();
45 ok(!Success, "%S: Expected failure, got success instead\n", GetProfileDirs->pFuncName);
46 ok(dwLastError == ERROR_INVALID_PARAMETER, "%S: Expected error %lu, got %lu\n",
47 GetProfileDirs->pFuncName, (DWORD)ERROR_INVALID_PARAMETER, dwLastError);
48
49 SetLastError(0xdeadbeef);
50 Success = GetProfileDirs->pFunc(szProfileDir, NULL);
51 dwLastError = GetLastError();
52 ok(!Success, "%S: Expected failure, got success instead\n", GetProfileDirs->pFuncName);
53 ok(dwLastError == ERROR_INVALID_PARAMETER, "%S: Expected error %lu, got %lu\n",
54 GetProfileDirs->pFuncName, (DWORD)ERROR_INVALID_PARAMETER, dwLastError);
55
56 cchSize = 0;
57 SetLastError(0xdeadbeef);
58 Success = GetProfileDirs->pFunc(NULL, &cchSize);
59 dwLastError = GetLastError();
60 ok(!Success, "%S: Expected failure, got success instead\n", GetProfileDirs->pFuncName);
61 ok(dwLastError == ERROR_INSUFFICIENT_BUFFER, "%S: Expected error %lu, got %lu\n",
62 GetProfileDirs->pFuncName, (DWORD)ERROR_INSUFFICIENT_BUFFER, dwLastError);
63 ok(cchSize != 0, "%S: Expected a profile directory size != 0, got 0\n", GetProfileDirs->pFuncName);
64
65 cchSize = 0;
66 SetLastError(0xdeadbeef);
67 Success = GetProfileDirs->pFunc(szProfileDir, &cchSize);
68 dwLastError = GetLastError();
69 ok(!Success, "%S: Expected failure, got success instead\n", GetProfileDirs->pFuncName);
70 ok(dwLastError == ERROR_INSUFFICIENT_BUFFER, "%S: Expected error %lu, got %lu\n",
71 GetProfileDirs->pFuncName, (DWORD)ERROR_INSUFFICIENT_BUFFER, dwLastError);
72 ok(cchSize != 0, "%S: Expected a profile directory size != 0, got 0\n", GetProfileDirs->pFuncName);
73
74 cchSize = _countof(szProfileDir);
75 SetLastError(0xdeadbeef);
76 Success = GetProfileDirs->pFunc(szProfileDir, &cchSize);
77 dwLastError = GetLastError();
78 ok(Success, "%S: Expected to success, got failure instead\n", GetProfileDirs->pFuncName);
79 ok(dwLastError == 0xdeadbeef, "%S: Expected error %lu, got %lu\n",
80 GetProfileDirs->pFuncName, (DWORD)0xdeadbeef, dwLastError);
81 ok(cchSize != 0, "%S: Expected a profile directory size != 0, got 0\n", GetProfileDirs->pFuncName);
82 ok(*szProfileDir, "%S: Expected a profile directory, got nothing\n", GetProfileDirs->pFuncName);
83 }
84
85 // TODO: Add more tests!
86}
GET_PROFILE_DIRS GetProfileDirsFuncsList[]
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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
Definition: glfuncs.h:248
unsigned short USHORT
Definition: pedump.c:61
#define _countof(array)
Definition: sndvol32.h:70
GET_PROFILE_DIRS_FUNC pFunc
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180

Variable Documentation

◆ GetProfileDirsFuncsList

GET_PROFILE_DIRS GetProfileDirsFuncsList[]
Initial value:
=
{
{GetAllUsersProfileDirectoryW, L"GetAllUsersProfileDirectoryW"},
{GetDefaultUserProfileDirectoryW, L"GetDefaultUserProfileDirectoryW"},
{GetProfilesDirectoryW, L"GetProfilesDirectoryW"},
}
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1310
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
BOOL WINAPI GetProfilesDirectoryW(_Out_ LPWSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1576
#define L(x)
Definition: ntvdm.h:50

Definition at line 20 of file GetProfileDirs.c.

Referenced by START_TEST().