mirror of
https://github.com/reactos/reactos.git
synced 2024-09-02 00:28:00 +00:00
Fixed ANSI/OEM <--> Unicode conversions
svn path=/trunk/; revision=1061
This commit is contained in:
parent
b820741431
commit
15c9809105
|
@ -27,11 +27,6 @@ FindResourceExA(
|
||||||
WORD wLanguage
|
WORD wLanguage
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// WCHAR ResourceNameW[MAX_PATH];
|
|
||||||
// WCHAR TypeNameW[MAX_PATH];
|
|
||||||
|
|
||||||
// WCHAR *ResourceName = ResourceNameW;
|
|
||||||
// WCHAR *TypeName = TypeNameW;
|
|
||||||
UNICODE_STRING TypeU;
|
UNICODE_STRING TypeU;
|
||||||
UNICODE_STRING NameU;
|
UNICODE_STRING NameU;
|
||||||
ANSI_STRING Type;
|
ANSI_STRING Type;
|
||||||
|
@ -136,7 +131,7 @@ FindResourceExW (
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nType = lpType;
|
nType = (ULONG)lpType;
|
||||||
|
|
||||||
Status = LdrFindResource_U(hModule,&ResourceDataEntry,lpName, nType,wLanguage);
|
Status = LdrFindResource_U(hModule,&ResourceDataEntry,lpName, nType,wLanguage);
|
||||||
if ( !NT_SUCCESS(Status ) ) {
|
if ( !NT_SUCCESS(Status ) ) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.22 2000/02/19 19:35:57 ekohl Exp $
|
/* $Id: create.c,v 1.23 2000/03/16 01:14:37 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -30,7 +30,10 @@
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
WINBOOL
|
||||||
|
STDCALL
|
||||||
|
CreateProcessA (
|
||||||
|
LPCSTR lpApplicationName,
|
||||||
LPSTR lpCommandLine,
|
LPSTR lpCommandLine,
|
||||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||||
|
@ -39,7 +42,8 @@ WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
||||||
LPVOID lpEnvironment,
|
LPVOID lpEnvironment,
|
||||||
LPCSTR lpCurrentDirectory,
|
LPCSTR lpCurrentDirectory,
|
||||||
LPSTARTUPINFOA lpStartupInfo,
|
LPSTARTUPINFOA lpStartupInfo,
|
||||||
LPPROCESS_INFORMATION lpProcessInformation)
|
LPPROCESS_INFORMATION lpProcessInformation
|
||||||
|
)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: The CreateProcess function creates a new process and its
|
* FUNCTION: The CreateProcess function creates a new process and its
|
||||||
* primary thread. The new process executes the specified executable file
|
* primary thread. The new process executes the specified executable file
|
||||||
|
@ -57,34 +61,65 @@ WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
||||||
* lpProcessInformation = Pointer to process information
|
* lpProcessInformation = Pointer to process information
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
WCHAR ApplicationNameW[MAX_PATH];
|
UNICODE_STRING ApplicationNameU;
|
||||||
WCHAR CommandLineW[MAX_PATH];
|
UNICODE_STRING CurrentDirectoryU;
|
||||||
WCHAR CurrentDirectoryW[MAX_PATH];
|
UNICODE_STRING CommandLineU;
|
||||||
PWSTR PApplicationNameW;
|
ANSI_STRING ApplicationName;
|
||||||
PWSTR PCommandLineW;
|
ANSI_STRING CurrentDirectory;
|
||||||
PWSTR PCurrentDirectoryW;
|
ANSI_STRING CommandLine;
|
||||||
|
WINBOOL Result;
|
||||||
|
|
||||||
DPRINT("CreateProcessA\n");
|
DPRINT("CreateProcessA\n");
|
||||||
|
|
||||||
PApplicationNameW = InternalAnsiToUnicode(ApplicationNameW,
|
RtlInitAnsiString (&CommandLine,
|
||||||
lpApplicationName,
|
lpCommandLine);
|
||||||
MAX_PATH);
|
RtlInitAnsiString (&ApplicationName,
|
||||||
PCommandLineW = InternalAnsiToUnicode(CommandLineW,
|
(LPSTR)lpApplicationName);
|
||||||
lpCommandLine,
|
RtlInitAnsiString (&CurrentDirectory,
|
||||||
MAX_PATH);
|
(LPSTR)lpCurrentDirectory);
|
||||||
PCurrentDirectoryW = InternalAnsiToUnicode(CurrentDirectoryW,
|
|
||||||
lpCurrentDirectory,
|
/* convert ansi (or oem) strings to unicode */
|
||||||
MAX_PATH);
|
if (bIsFileApiAnsi)
|
||||||
return CreateProcessW(PApplicationNameW,
|
{
|
||||||
PCommandLineW,
|
RtlAnsiStringToUnicodeString (&CommandLineU,
|
||||||
|
&CommandLine,
|
||||||
|
TRUE);
|
||||||
|
RtlAnsiStringToUnicodeString (&ApplicationNameU,
|
||||||
|
&ApplicationName,
|
||||||
|
TRUE);
|
||||||
|
RtlAnsiStringToUnicodeString (&CurrentDirectoryU,
|
||||||
|
&CurrentDirectory,
|
||||||
|
TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlOemStringToUnicodeString (&CommandLineU,
|
||||||
|
&CommandLine,
|
||||||
|
TRUE);
|
||||||
|
RtlOemStringToUnicodeString (&ApplicationNameU,
|
||||||
|
&ApplicationName,
|
||||||
|
TRUE);
|
||||||
|
RtlOemStringToUnicodeString (&CurrentDirectoryU,
|
||||||
|
&CurrentDirectory,
|
||||||
|
TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = CreateProcessW (ApplicationNameU.Buffer,
|
||||||
|
CommandLineU.Buffer,
|
||||||
lpProcessAttributes,
|
lpProcessAttributes,
|
||||||
lpThreadAttributes,
|
lpThreadAttributes,
|
||||||
bInheritHandles,
|
bInheritHandles,
|
||||||
dwCreationFlags,
|
dwCreationFlags,
|
||||||
lpEnvironment,
|
lpEnvironment,
|
||||||
PCurrentDirectoryW,
|
CurrentDirectoryU.Buffer,
|
||||||
(LPSTARTUPINFOW)lpStartupInfo,
|
(LPSTARTUPINFOW)lpStartupInfo,
|
||||||
lpProcessInformation);
|
lpProcessInformation);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString (&ApplicationNameU);
|
||||||
|
RtlFreeUnicodeString (&CommandLineU);
|
||||||
|
RtlFreeUnicodeString (&CurrentDirectoryU);
|
||||||
|
|
||||||
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STACK_TOP (0xb0000000)
|
#define STACK_TOP (0xb0000000)
|
||||||
|
@ -442,6 +477,11 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hSection = KlMapFile (lpApplicationName, lpCommandLine);
|
hSection = KlMapFile (lpApplicationName, lpCommandLine);
|
||||||
|
if (hSection == NULL)
|
||||||
|
{
|
||||||
|
RtlDestroyProcessParameters (Ppb);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new process
|
* Create a new process
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: proc.c,v 1.30 2000/02/19 19:35:57 ekohl Exp $
|
/* $Id: proc.c,v 1.31 2000/03/16 01:14:37 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -136,34 +136,6 @@ GetProcessId (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PWSTR
|
|
||||||
InternalAnsiToUnicode (
|
|
||||||
PWSTR Out,
|
|
||||||
LPCSTR In,
|
|
||||||
ULONG MaxLength
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
if (In == NULL)
|
|
||||||
{
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i = 0;
|
|
||||||
while ((*In)!=0 && i < MaxLength)
|
|
||||||
{
|
|
||||||
Out[i] = *In;
|
|
||||||
In++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
Out[i] = 0;
|
|
||||||
return(Out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
STDCALL
|
STDCALL
|
||||||
OpenProcess (
|
OpenProcess (
|
||||||
|
@ -265,14 +237,23 @@ WaitForInputIdle (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL Sleep (DWORD dwMilliseconds)
|
VOID
|
||||||
|
STDCALL
|
||||||
|
Sleep (
|
||||||
|
DWORD dwMilliseconds
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SleepEx (dwMilliseconds, FALSE);
|
SleepEx (dwMilliseconds, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL SleepEx(DWORD dwMilliseconds,
|
|
||||||
BOOL bAlertable)
|
DWORD
|
||||||
|
STDCALL
|
||||||
|
SleepEx (
|
||||||
|
DWORD dwMilliseconds,
|
||||||
|
BOOL bAlertable
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TIME Interval;
|
TIME Interval;
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
@ -412,8 +393,7 @@ FlushInstructionCache (
|
||||||
errCode = NtFlushInstructionCache(
|
errCode = NtFlushInstructionCache(
|
||||||
hProcess,
|
hProcess,
|
||||||
(PVOID) lpBaseAddress,
|
(PVOID) lpBaseAddress,
|
||||||
dwSize
|
dwSize);
|
||||||
);
|
|
||||||
if (!NT_SUCCESS(errCode))
|
if (!NT_SUCCESS(errCode))
|
||||||
{
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(errCode));
|
SetLastError(RtlNtStatusToDosError(errCode));
|
||||||
|
@ -429,10 +409,8 @@ ExitProcess (
|
||||||
UINT uExitCode
|
UINT uExitCode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NtTerminateProcess(
|
NtTerminateProcess (NtCurrentProcess (),
|
||||||
NtCurrentProcess(),
|
uExitCode);
|
||||||
uExitCode
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -444,6 +422,7 @@ TerminateProcess (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
|
||||||
errCode = NtTerminateProcess(hProcess, uExitCode);
|
errCode = NtTerminateProcess(hProcess, uExitCode);
|
||||||
if (!NT_SUCCESS(errCode))
|
if (!NT_SUCCESS(errCode))
|
||||||
{
|
{
|
||||||
|
@ -453,6 +432,7 @@ TerminateProcess (
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
FatalAppExitA (
|
FatalAppExitA (
|
||||||
|
@ -460,18 +440,20 @@ FatalAppExitA (
|
||||||
LPCSTR lpMessageText
|
LPCSTR lpMessageText
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR MessageTextW[MAX_PATH];
|
UNICODE_STRING MessageTextU;
|
||||||
UINT i;
|
ANSI_STRING MessageText;
|
||||||
i = 0;
|
|
||||||
while ((*lpMessageText)!=0 && i < 35)
|
|
||||||
{
|
|
||||||
MessageTextW[i] = *lpMessageText;
|
|
||||||
lpMessageText++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
MessageTextW[i] = 0;
|
|
||||||
|
|
||||||
return FatalAppExitW(uAction,MessageTextW);
|
RtlInitAnsiString (&MessageText,
|
||||||
|
(LPSTR)lpMessageText);
|
||||||
|
|
||||||
|
RtlAnsiStringToUnicodeString (&MessageTextU,
|
||||||
|
&MessageText,
|
||||||
|
TRUE);
|
||||||
|
|
||||||
|
FatalAppExitW (uAction,
|
||||||
|
MessageTextU.Buffer);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString (&MessageTextU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue