mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:52:56 +00:00
[MSVCRT:APITEST]
Move cmdline_util to CmdLineUtil and locate it in bin/data instead of bin svn path=/trunk/; revision=57527
This commit is contained in:
parent
2a41d13595
commit
4690bf4891
6 changed files with 40 additions and 31 deletions
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
add_subdirectory(cmdline_util)
|
add_subdirectory(CmdLineUtil)
|
||||||
|
|
||||||
add_definitions(-D_DLL -D__USE_CRTIMP)
|
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
CommandLine.c
|
CommandLine.c
|
||||||
|
|
8
rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt
Normal file
8
rostests/apitests/msvcrt/CmdLineUtil/CMakeLists.txt
Normal file
|
@ -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)
|
|
@ -10,6 +10,8 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ndk/ntndk.h>
|
#include <ndk/ntndk.h>
|
||||||
|
|
||||||
|
#include "CmdLineUtil.h"
|
||||||
|
|
||||||
int APIENTRY wWinMain(HINSTANCE hInstance,
|
int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPWSTR lpCmdLine,
|
LPWSTR lpCmdLine,
|
||||||
|
@ -23,7 +25,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||||
UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
|
UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
|
||||||
|
|
||||||
/* Write the results into a file. */
|
/* Write the results into a file. */
|
||||||
HANDLE hFile = CreateFileW(L"C:\\cmdline.dat",
|
HANDLE hFile = CreateFileW(DATAFILE,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
CREATE_ALWAYS,
|
CREATE_ALWAYS,
|
13
rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h
Normal file
13
rostests/apitests/msvcrt/CmdLineUtil/CmdLineUtil.h
Normal file
|
@ -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 <hermes.belusca@sfr.fr>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// The path to the data file.
|
||||||
|
#define DATAFILE L"C:\\cmdline.dat"
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -11,20 +11,16 @@
|
||||||
#include <wine/test.h>
|
#include <wine/test.h>
|
||||||
#include <ndk/ntndk.h>
|
#include <ndk/ntndk.h>
|
||||||
|
|
||||||
#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0]))
|
#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
|
* Extracts the command tail from the command line
|
||||||
* (deletes the program's name and keep the rest).
|
* (deletes the program's name and keep the rest).
|
||||||
**/
|
**/
|
||||||
#define SPACECHAR L' '
|
#define SPACECHAR L' '
|
||||||
#define DQUOTECHAR L'\"'
|
#define DQUOTECHAR L'"'
|
||||||
|
|
||||||
LPWSTR ExtractCmdLine(IN LPWSTR lpszCommandLine)
|
LPWSTR ExtractCmdLine(IN LPWSTR lpszCommandLine)
|
||||||
{
|
{
|
||||||
|
@ -98,18 +94,18 @@ typedef struct _TEST_CASE
|
||||||
|
|
||||||
static TEST_CASE TestCases[] =
|
static TEST_CASE TestCases[] =
|
||||||
{
|
{
|
||||||
{L"cmdline_util.exe"},
|
{L"CmdLineUtil.exe"},
|
||||||
{L"cmdline_util.exe foo bar"},
|
{L"CmdLineUtil.exe foo bar"},
|
||||||
{L"cmdline_util.exe \"foo bar\""},
|
{L"CmdLineUtil.exe \"foo bar\""},
|
||||||
{L"cmdline_util.exe foo \"bar John\" Doe"},
|
{L"CmdLineUtil.exe foo \"bar John\" Doe"},
|
||||||
|
|
||||||
{L"\"cmdline_util.exe\""},
|
{L"\"CmdLineUtil.exe\""},
|
||||||
{L"\"cmdline_util.exe\" foo bar"},
|
{L"\"CmdLineUtil.exe\" foo bar"},
|
||||||
{L"\"cmdline_util.exe\" \"foo bar\""},
|
{L"\"CmdLineUtil.exe\" \"foo bar\""},
|
||||||
{L"\"cmdline_util.exe\" foo \"bar John\" Doe"},
|
{L"\"CmdLineUtil.exe\" foo \"bar John\" Doe"},
|
||||||
|
|
||||||
{L"\"cmdline_util.exe\""},
|
{L"\"CmdLineUtil.exe\""},
|
||||||
{L"\"cmdline_util.exe \"foo bar\"\""},
|
{L"\"CmdLineUtil.exe \"foo bar\"\""},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Test_CommandLine(IN ULONG TestNumber,
|
static void Test_CommandLine(IN ULONG TestNumber,
|
||||||
|
@ -237,6 +233,7 @@ static void Test_CommandLine(IN ULONG TestNumber,
|
||||||
ExtractCmdLine_U(&NTCmdLine);
|
ExtractCmdLine_U(&NTCmdLine);
|
||||||
|
|
||||||
/* Print the results */
|
/* Print the results */
|
||||||
|
/*
|
||||||
*(LPWSTR)((ULONG_PTR)NTCmdLine.Buffer + NTCmdLine.Length) = 0;
|
*(LPWSTR)((ULONG_PTR)NTCmdLine.Buffer + NTCmdLine.Length) = 0;
|
||||||
printf("WinMain cmdline = '%S'\n"
|
printf("WinMain cmdline = '%S'\n"
|
||||||
"Win32 cmdline = '%S'\n"
|
"Win32 cmdline = '%S'\n"
|
||||||
|
@ -245,6 +242,7 @@ static void Test_CommandLine(IN ULONG TestNumber,
|
||||||
WinMainCmdLine,
|
WinMainCmdLine,
|
||||||
Win32CmdLine,
|
Win32CmdLine,
|
||||||
NTCmdLine.Buffer, NTCmdLine.Length);
|
NTCmdLine.Buffer, NTCmdLine.Length);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now check the results.
|
* Now check the results.
|
||||||
|
|
|
@ -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)
|
|
Loading…
Add table
Add a link
Reference in a new issue