diff --git a/rostests/apitests/msvcrt/CMakeLists.txt b/rostests/apitests/msvcrt/CMakeLists.txt index 07022be9e40..fc853c776f8 100644 --- a/rostests/apitests/msvcrt/CMakeLists.txt +++ b/rostests/apitests/msvcrt/CMakeLists.txt @@ -1,7 +1,5 @@ -add_subdirectory(cmdline_util) - -add_definitions(-D_DLL -D__USE_CRTIMP) +add_subdirectory(CmdLineUtil) list(APPEND SOURCE CommandLine.c diff --git a/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt b/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt new file mode 100644 index 00000000000..6a0706360db --- /dev/null +++ b/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt @@ -0,0 +1,8 @@ + +list(APPEND SOURCE + CmdLineUtil.c) + +add_executable(CmdLineUtil ${SOURCE}) +set_module_type(CmdLineUtil win32gui UNICODE) +add_importlibs(CmdLineUtil msvcrt kernel32 ntdll) +add_cd_file(TARGET CmdLineUtil DESTINATION reactos/bin/data FOR all) diff --git a/rostests/apitests/msvcrt/cmdline_util/cmdline_util.c b/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c similarity index 97% rename from rostests/apitests/msvcrt/cmdline_util/cmdline_util.c rename to rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c index 007e7f088e1..11af856ee06 100644 --- a/rostests/apitests/msvcrt/cmdline_util/cmdline_util.c +++ b/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c @@ -10,6 +10,8 @@ #include #include +#include "CmdLineUtil.h" + int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, @@ -23,7 +25,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine; /* Write the results into a file. */ - HANDLE hFile = CreateFileW(L"C:\\cmdline.dat", + HANDLE hFile = CreateFileW(DATAFILE, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, diff --git a/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h b/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h new file mode 100644 index 00000000000..974cb0f47aa --- /dev/null +++ b/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h @@ -0,0 +1,13 @@ +/* + * PROJECT: ReactOS API Tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for CRT command-line handling - Utility GUI program. + * PROGRAMMER: Hermès BÉLUSCA - MAÏTO + */ + +#pragma once + +// The path to the data file. +#define DATAFILE L"C:\\cmdline.dat" + +/* EOF */ diff --git a/rostests/apitests/msvcrt/CommandLine.c b/rostests/apitests/msvcrt/CommandLine.c index e6b6c999c81..fd9779f001e 100644 --- a/rostests/apitests/msvcrt/CommandLine.c +++ b/rostests/apitests/msvcrt/CommandLine.c @@ -11,20 +11,16 @@ #include #include -#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0])) +#include "./CmdLineUtil/CmdLineUtil.h" -/* - * The path to the data file is hardcoded in cmdline_util.c - * Please synchronize it whenever you do a change. - */ -#define DATAFILE L"C:\\cmdline.dat" +#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0])) /** * Extracts the command tail from the command line * (deletes the program's name and keep the rest). **/ #define SPACECHAR L' ' -#define DQUOTECHAR L'\"' +#define DQUOTECHAR L'"' LPWSTR ExtractCmdLine(IN LPWSTR lpszCommandLine) { @@ -98,18 +94,18 @@ typedef struct _TEST_CASE static TEST_CASE TestCases[] = { - {L"cmdline_util.exe"}, - {L"cmdline_util.exe foo bar"}, - {L"cmdline_util.exe \"foo bar\""}, - {L"cmdline_util.exe foo \"bar John\" Doe"}, + {L"CmdLineUtil.exe"}, + {L"CmdLineUtil.exe foo bar"}, + {L"CmdLineUtil.exe \"foo bar\""}, + {L"CmdLineUtil.exe foo \"bar John\" Doe"}, - {L"\"cmdline_util.exe\""}, - {L"\"cmdline_util.exe\" foo bar"}, - {L"\"cmdline_util.exe\" \"foo bar\""}, - {L"\"cmdline_util.exe\" foo \"bar John\" Doe"}, + {L"\"CmdLineUtil.exe\""}, + {L"\"CmdLineUtil.exe\" foo bar"}, + {L"\"CmdLineUtil.exe\" \"foo bar\""}, + {L"\"CmdLineUtil.exe\" foo \"bar John\" Doe"}, - {L"\"cmdline_util.exe\""}, - {L"\"cmdline_util.exe \"foo bar\"\""}, + {L"\"CmdLineUtil.exe\""}, + {L"\"CmdLineUtil.exe \"foo bar\"\""}, }; static void Test_CommandLine(IN ULONG TestNumber, @@ -237,6 +233,7 @@ static void Test_CommandLine(IN ULONG TestNumber, ExtractCmdLine_U(&NTCmdLine); /* Print the results */ + /* *(LPWSTR)((ULONG_PTR)NTCmdLine.Buffer + NTCmdLine.Length) = 0; printf("WinMain cmdline = '%S'\n" "Win32 cmdline = '%S'\n" @@ -245,6 +242,7 @@ static void Test_CommandLine(IN ULONG TestNumber, WinMainCmdLine, Win32CmdLine, NTCmdLine.Buffer, NTCmdLine.Length); + */ /* * Now check the results. diff --git a/rostests/apitests/msvcrt/cmdline_util/CMakeLists.txt b/rostests/apitests/msvcrt/cmdline_util/CMakeLists.txt deleted file mode 100644 index ce0cf5bae93..00000000000 --- a/rostests/apitests/msvcrt/cmdline_util/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - -add_definitions(-D_DLL -D__USE_CRTIMP) - -list(APPEND SOURCE - cmdline_util.c) - -add_executable(cmdline_util ${SOURCE}) -set_module_type(cmdline_util win32gui UNICODE) -add_importlibs(cmdline_util msvcrt kernel32 ntdll) -add_cd_file(TARGET cmdline_util DESTINATION reactos/bin FOR all)