ReactOS  0.4.14-dev-342-gdc047f9
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 {
30  BOOL Success;
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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define _countof(array)
Definition: fontsub.cpp:30
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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 int BOOL
Definition: ntddk_ex.h:94
GET_PROFILE_DIRS_FUNC pFunc
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
GET_PROFILE_DIRS GetProfileDirsFuncsList[]
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Variable Documentation

◆ GetProfileDirsFuncsList

GET_PROFILE_DIRS GetProfileDirsFuncsList[]
Initial value:
=
{
{GetAllUsersProfileDirectoryW, L"GetAllUsersProfileDirectoryW"},
{GetDefaultUserProfileDirectoryW, L"GetDefaultUserProfileDirectoryW"},
{GetProfilesDirectoryW, L"GetProfilesDirectoryW"},
}
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1360
BOOL WINAPI GetProfilesDirectoryW(_Out_ LPWSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1493
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1227

Definition at line 20 of file GetProfileDirs.c.

Referenced by START_TEST().