Commit de654656 authored by YongHao Hu's avatar YongHao Hu Committed by Alexandre Julliard

msvcp110: Add tr2_sys__Current_get implementation and test.

parent 94e03424
......@@ -1167,8 +1167,8 @@
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z
@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPADPAD@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADPEAD@Z
@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADPAD@Z(ptr) tr2_sys__Current_get
@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADPEAD@Z(ptr) tr2_sys__Current_get
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WPA_W@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WPEA_W@Z
@ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z
......
......@@ -1132,8 +1132,8 @@
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z
@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z
@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) tr2_sys__Current_get
@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) tr2_sys__Current_get
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z
@ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z
......
......@@ -61,6 +61,7 @@ static void (CDECL *p__Do_call)(void *this);
/* filesystem */
static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*);
static char* (__cdecl *p_tr2_sys__Current_get)(char *);
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
......@@ -93,11 +94,15 @@ static BOOL init(void)
"?_File_size@sys@tr2@std@@YA_KPEBD@Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPEBD0@Z");
SET(p_tr2_sys__Current_get,
"?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z");
} else {
SET(p_tr2_sys__File_size,
"?_File_size@sys@tr2@std@@YA_KPBD@Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPBD0@Z");
SET(p_tr2_sys__Current_get,
"?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z");
}
msvcr = GetModuleHandleA("msvcr120.dll");
......@@ -395,6 +400,29 @@ static void test_tr2_sys__Equivalent(void)
ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n");
}
static void test_tr2_sys__Current_get(void)
{
char temp_path[MAX_PATH], current_path[MAX_PATH], origin_path[MAX_PATH];
char *temp;
memset(origin_path, 0, MAX_PATH);
GetCurrentDirectoryA(MAX_PATH, origin_path);
memset(temp_path, 0, MAX_PATH);
GetTempPathA(MAX_PATH, temp_path);
ok(SetCurrentDirectoryA(temp_path), "SetCurrentDirectoryA to temp_path failed\n");
memset(current_path, 0, MAX_PATH);
temp = p_tr2_sys__Current_get(current_path);
ok(temp == current_path, "p_tr2_sys__Current_get returned different buffer\n");
temp[strlen(temp)] = '\\';
ok(!strcmp(temp_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", temp_path, current_path);
ok(SetCurrentDirectoryA(origin_path), "SetCurrentDirectoryA to origin_path failed\n");
memset(current_path, 0, MAX_PATH);
temp = p_tr2_sys__Current_get(current_path);
ok(temp == current_path, "p_tr2_sys__Current_get returned different buffer\n");
ok(!strcmp(origin_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", origin_path, current_path);
}
START_TEST(msvcp120)
{
if(!init()) return;
......@@ -406,5 +434,6 @@ START_TEST(msvcp120)
test_tr2_sys__File_size();
test_tr2_sys__Equivalent();
test_tr2_sys__Current_get();
FreeLibrary(msvcp);
}
......@@ -1132,8 +1132,8 @@
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z
@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z
@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z
@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z
@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z
@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z
@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z
@ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z
......
......@@ -14241,6 +14241,17 @@ int __cdecl tr2_sys__Equivalent(char const* path1, char const* path2)
);
}
/* ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z */
/* ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z */
char* __cdecl tr2_sys__Current_get(char *current_path)
{
TRACE("(%p)\n", current_path);
if(!GetCurrentDirectoryA(MAX_PATH, current_path))
return NULL;
return current_path;
}
/* ??0strstream@std@@QAE@PADHH@Z */
/* ??0strstream@std@@QEAA@PEAD_JH@Z */
#if STREAMSIZE_BITS == 64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment