ReactOS  0.4.14-dev-358-gbef841c
SetCurrentDirectory.c File Reference
#include "precomp.h"
Include dependency graph for SetCurrentDirectory.c:

Go to the source code of this file.

Functions

static VOID SetUnrelatedDirectory (VOID)
 
static VOID TestSetCurrentDirectoryA (VOID)
 
static VOID TestSetCurrentDirectoryW (VOID)
 
 START_TEST (SetCurrentDirectory)
 

Function Documentation

◆ SetUnrelatedDirectory()

static VOID SetUnrelatedDirectory ( VOID  )
static

Definition at line 12 of file SetCurrentDirectory.c.

13 {
15  BOOL Ret;
16 
17  GetWindowsDirectoryW(Buffer, sizeof(Buffer) / sizeof(WCHAR));
19  ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
20 }
#define TRUE
Definition: types.h:120
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
#define ok(value,...)
Definition: atltest.h:57

Referenced by TestSetCurrentDirectoryA(), and TestSetCurrentDirectoryW().

◆ START_TEST()

START_TEST ( SetCurrentDirectory  )

Definition at line 102 of file SetCurrentDirectory.c.

103 {
106 }
static VOID TestSetCurrentDirectoryW(VOID)
static VOID TestSetCurrentDirectoryA(VOID)

◆ TestSetCurrentDirectoryA()

static VOID TestSetCurrentDirectoryA ( VOID  )
static

Definition at line 24 of file SetCurrentDirectory.c.

25 {
26  BOOL Ret;
28  DWORD Length;
29 
31 
32  Ret = SetCurrentDirectoryA("C:\\");
33  ok(Ret == TRUE, "SetCurrentDirectoryA failed\n");
35  ok(Length == 3, "Length = %lu\n", Length);
36  ok(!strcmp(Buffer, "C:\\"), "Current directory is %s\n", Buffer);
37 
38  /* Same directory - succeeds */
39  Ret = SetCurrentDirectoryA("C:\\");
40  ok(Ret == TRUE, "SetCurrentDirectoryA failed\n");
42  ok(Length == 3, "Length = %lu\n", Length);
43  ok(!strcmp(Buffer, "C:\\"), "Current directory is %s\n", Buffer);
44 
45  /* Same directory, lowercase - succeeds and does not change case */
46  Ret = SetCurrentDirectoryA("c:\\");
47  ok(Ret == TRUE, "SetCurrentDirectoryA failed\n");
49  ok(Length == 3, "Length = %lu\n", Length);
50  ok(!strcmp(Buffer, "C:\\"), "Current directory is %s\n", Buffer);
51 
53 
54  /* Now this one does change case */
55  Ret = SetCurrentDirectoryA("c:\\");
56  ok(Ret == TRUE, "SetCurrentDirectoryA failed\n");
58  ok(Length == 3, "Length = %lu\n", Length);
59  ok(!strcmp(Buffer, "c:\\"), "Current directory is %s\n", Buffer);
60 }
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static VOID SetUnrelatedDirectory(VOID)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ TestSetCurrentDirectoryW()

static VOID TestSetCurrentDirectoryW ( VOID  )
static

Definition at line 64 of file SetCurrentDirectory.c.

65 {
66  BOOL Ret;
68  DWORD Length;
69 
71 
72  Ret = SetCurrentDirectoryW(L"C:\\");
73  ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
74  Length = GetCurrentDirectoryW(sizeof(Buffer) / sizeof(WCHAR), Buffer);
75  ok(Length == 3, "Length = %lu\n", Length);
76  ok(!wcscmp(Buffer, L"C:\\"), "Current directory is %ls\n", Buffer);
77 
78  /* Same directory - succeeds */
79  Ret = SetCurrentDirectoryW(L"C:\\");
80  ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
81  Length = GetCurrentDirectoryW(sizeof(Buffer) / sizeof(WCHAR), Buffer);
82  ok(Length == 3, "Length = %lu\n", Length);
83  ok(!wcscmp(Buffer, L"C:\\"), "Current directory is %ls\n", Buffer);
84 
85  /* Same directory, lowercase - succeeds and does not change case */
86  Ret = SetCurrentDirectoryW(L"c:\\");
87  ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
88  Length = GetCurrentDirectoryW(sizeof(Buffer) / sizeof(WCHAR), Buffer);
89  ok(Length == 3, "Length = %lu\n", Length);
90  ok(!wcscmp(Buffer, L"C:\\"), "Current directory is %ls\n", Buffer);
91 
93 
94  /* Now this one does change case */
95  Ret = SetCurrentDirectoryW(L"c:\\");
96  ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
97  Length = GetCurrentDirectoryW(sizeof(Buffer) / sizeof(WCHAR), Buffer);
98  ok(Length == 3, "Length = %lu\n", Length);
99  ok(!wcscmp(Buffer, L"c:\\"), "Current directory is %ls\n", Buffer);
100 }
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
#define ok(value,...)
Definition: atltest.h:57
static VOID SetUnrelatedDirectory(VOID)

Referenced by START_TEST().