ReactOS 0.4.15-dev-7958-gcd0bb1a
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 ok(value,...)
Definition: atltest.h:57
Definition: bufpool.h:45
#define TRUE
Definition: types.h:120
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
unsigned int BOOL
Definition: ntddk_ex.h:94
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by TestSetCurrentDirectoryA(), and TestSetCurrentDirectoryW().

◆ START_TEST()

START_TEST ( SetCurrentDirectory  )

Definition at line 102 of file SetCurrentDirectory.c.

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

◆ TestSetCurrentDirectoryA()

static VOID TestSetCurrentDirectoryA ( VOID  )
static

Definition at line 24 of file SetCurrentDirectory.c.

25{
26 BOOL Ret;
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}
static VOID SetUnrelatedDirectory(VOID)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ TestSetCurrentDirectoryW()

static VOID TestSetCurrentDirectoryW ( VOID  )
static

Definition at line 64 of file SetCurrentDirectory.c.

65{
66 BOOL Ret;
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 GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by START_TEST().