Author: hbelusca
Date: Tue Oct 9 22:03:50 2012
New Revision: 57527
URL:
http://svn.reactos.org/svn/reactos?rev=57527&view=rev
Log:
[MSVCRT:APITEST]
Move cmdline_util to CmdLineUtil and locate it in bin/data instead of bin
Added:
trunk/rostests/apitests/msvcrt/CmdLineUtil/
- copied from r57524, trunk/rostests/apitests/msvcrt/cmdline_util/
trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c (with props)
trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h (with props)
Removed:
trunk/rostests/apitests/msvcrt/CmdLineUtil/cmdline_util.c
trunk/rostests/apitests/msvcrt/cmdline_util/
Modified:
trunk/rostests/apitests/msvcrt/CMakeLists.txt
trunk/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt
trunk/rostests/apitests/msvcrt/CommandLine.c
Modified: trunk/rostests/apitests/msvcrt/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CMakeList…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/CMakeLists.txt [iso-8859-1] Tue Oct 9 22:03:50 2012
@@ -1,7 +1,5 @@
-add_subdirectory(cmdline_util)
-
-add_definitions(-D_DLL -D__USE_CRTIMP)
+add_subdirectory(CmdLineUtil)
list(APPEND SOURCE
CommandLine.c
Modified: trunk/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CmdLineUt…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt [iso-8859-1] Tue Oct 9
22:03:50 2012
@@ -1,10 +1,8 @@
-
-add_definitions(-D_DLL -D__USE_CRTIMP)
list(APPEND SOURCE
- cmdline_util.c)
+ CmdLineUtil.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)
+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)
Added: trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CmdLineUt…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c (added)
+++ trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c [iso-8859-1] Tue Oct 9
22:03:50 2012
@@ -1,0 +1,96 @@
+/*
+ * 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 <hermes.belusca(a)sfr.fr>
+ */
+
+#define WIN32_NO_STATUS
+#include <stdio.h>
+#include <windows.h>
+#include <ndk/ntndk.h>
+
+#include "CmdLineUtil.h"
+
+int APIENTRY wWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPWSTR lpCmdLine,
+ int nCmdShow)
+{
+ /*
+ * Get the unparsed command line as seen in Win32 mode,
+ * and the NT-native mode one.
+ */
+ LPWSTR CmdLine = GetCommandLineW();
+ UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
+
+ /* Write the results into a file. */
+ HANDLE hFile = CreateFileW(DATAFILE,
+ GENERIC_WRITE,
+ 0, NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ DWORD dwSize, dwStringSize;
+
+ /*
+ * Format of the data file :
+ *
+ * [size_of_string 4 bytes][null_terminated_C_string]
+ * [size_of_string 4 bytes][null_terminated_C_string]
+ * [UNICODE_STRING_structure][string_buffer_of_UNICODE_STRING]
+ */
+
+ /* 1- Write the WinMain's command line. */
+ dwStringSize = (wcslen(lpCmdLine) + 1) * sizeof(WCHAR);
+
+ WriteFile(hFile,
+ &dwStringSize,
+ sizeof(dwStringSize),
+ &dwSize,
+ NULL);
+
+ WriteFile(hFile,
+ lpCmdLine,
+ dwStringSize,
+ &dwSize,
+ NULL);
+
+ /* 2- Write the Win32 mode command line. */
+ dwStringSize = (wcslen(CmdLine) + 1) * sizeof(WCHAR);
+
+ WriteFile(hFile,
+ &dwStringSize,
+ sizeof(dwStringSize),
+ &dwSize,
+ NULL);
+
+ WriteFile(hFile,
+ CmdLine,
+ dwStringSize,
+ &dwSize,
+ NULL);
+
+ /* 3- Finally, write the UNICODE_STRING command line. */
+ WriteFile(hFile,
+ &CmdLine_U,
+ sizeof(CmdLine_U),
+ &dwSize,
+ NULL);
+
+ WriteFile(hFile,
+ CmdLine_U.Buffer,
+ CmdLine_U.Length,
+ &dwSize,
+ NULL);
+
+ /* Now close the file. */
+ CloseHandle(hFile);
+ }
+
+ return 0;
+}
+
+/* EOF */
Propchange: trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CmdLineUt…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h (added)
+++ trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h [iso-8859-1] Tue Oct 9
22:03:50 2012
@@ -1,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 <hermes.belusca(a)sfr.fr>
+ */
+
+#pragma once
+
+// The path to the data file.
+#define DATAFILE L"C:\\cmdline.dat"
+
+/* EOF */
Propchange: trunk/rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h
------------------------------------------------------------------------------
svn:eol-style = native
Removed: trunk/rostests/apitests/msvcrt/CmdLineUtil/cmdline_util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/cmdline_u…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CmdLineUtil/cmdline_util.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/CmdLineUtil/cmdline_util.c (removed)
@@ -1,94 +1,0 @@
-/*
- * 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 <hermes.belusca(a)sfr.fr>
- */
-
-#define WIN32_NO_STATUS
-#include <stdio.h>
-#include <windows.h>
-#include <ndk/ntndk.h>
-
-int APIENTRY wWinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPWSTR lpCmdLine,
- int nCmdShow)
-{
- /*
- * Get the unparsed command line as seen in Win32 mode,
- * and the NT-native mode one.
- */
- LPWSTR CmdLine = GetCommandLineW();
- UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
-
- /* Write the results into a file. */
- HANDLE hFile = CreateFileW(L"C:\\cmdline.dat",
- GENERIC_WRITE,
- 0, NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (hFile != INVALID_HANDLE_VALUE)
- {
- DWORD dwSize, dwStringSize;
-
- /*
- * Format of the data file :
- *
- * [size_of_string 4 bytes][null_terminated_C_string]
- * [size_of_string 4 bytes][null_terminated_C_string]
- * [UNICODE_STRING_structure][string_buffer_of_UNICODE_STRING]
- */
-
- /* 1- Write the WinMain's command line. */
- dwStringSize = (wcslen(lpCmdLine) + 1) * sizeof(WCHAR);
-
- WriteFile(hFile,
- &dwStringSize,
- sizeof(dwStringSize),
- &dwSize,
- NULL);
-
- WriteFile(hFile,
- lpCmdLine,
- dwStringSize,
- &dwSize,
- NULL);
-
- /* 2- Write the Win32 mode command line. */
- dwStringSize = (wcslen(CmdLine) + 1) * sizeof(WCHAR);
-
- WriteFile(hFile,
- &dwStringSize,
- sizeof(dwStringSize),
- &dwSize,
- NULL);
-
- WriteFile(hFile,
- CmdLine,
- dwStringSize,
- &dwSize,
- NULL);
-
- /* 3- Finally, write the UNICODE_STRING command line. */
- WriteFile(hFile,
- &CmdLine_U,
- sizeof(CmdLine_U),
- &dwSize,
- NULL);
-
- WriteFile(hFile,
- CmdLine_U.Buffer,
- CmdLine_U.Length,
- &dwSize,
- NULL);
-
- /* Now close the file. */
- CloseHandle(hFile);
- }
-
- return 0;
-}
-
-/* EOF */
Modified: trunk/rostests/apitests/msvcrt/CommandLine.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CommandLi…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CommandLine.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/CommandLine.c [iso-8859-1] Tue Oct 9 22:03:50 2012
@@ -11,20 +11,16 @@
#include <wine/test.h>
#include <ndk/ntndk.h>
+#include "./CmdLineUtil/CmdLineUtil.h"
+
#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0]))
-
-/*
- * 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"
/**
* 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 @@
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"\"cmdline_util.exe\""},
- {L"\"cmdline_util.exe\" foo bar"},
- {L"\"cmdline_util.exe\" \"foo bar\""},
- {L"\"cmdline_util.exe\" foo \"bar John\" Doe"},
-
- {L"\"cmdline_util.exe\""},
- {L"\"cmdline_util.exe \"foo bar\"\""},
+ {L"CmdLineUtil.exe"},
+ {L"CmdLineUtil.exe foo bar"},
+ {L"CmdLineUtil.exe \"foo bar\""},
+ {L"CmdLineUtil.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"\"CmdLineUtil.exe\""},
+ {L"\"CmdLineUtil.exe \"foo bar\"\""},
};
static void Test_CommandLine(IN ULONG TestNumber,
@@ -237,6 +233,7 @@
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 @@
WinMainCmdLine,
Win32CmdLine,
NTCmdLine.Buffer, NTCmdLine.Length);
+ */
/*
* Now check the results.