ReactOS 0.4.15-dev-7705-g2320c37
SetCurrentDirectory.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for SetCurrentDirectory
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include "precomp.h"
9
10static
11VOID
13{
15 BOOL Ret;
16
17 GetWindowsDirectoryW(Buffer, sizeof(Buffer) / sizeof(WCHAR));
19 ok(Ret == TRUE, "SetCurrentDirectoryW failed\n");
20}
21
22static
23VOID
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}
61
62static
63VOID
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}
101
103{
106}
static VOID TestSetCurrentDirectoryA(VOID)
static VOID TestSetCurrentDirectoryW(VOID)
static VOID SetUnrelatedDirectory(VOID)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
Definition: bufpool.h:45
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#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)
#define SetCurrentDirectory
Definition: winbase.h:3838
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175