mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 01:13:38 +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
|
||||
)
|
||||
{
|
||||
// WCHAR ResourceNameW[MAX_PATH];
|
||||
// WCHAR TypeNameW[MAX_PATH];
|
||||
|
||||
// WCHAR *ResourceName = ResourceNameW;
|
||||
// WCHAR *TypeName = TypeNameW;
|
||||
UNICODE_STRING TypeU;
|
||||
UNICODE_STRING NameU;
|
||||
ANSI_STRING Type;
|
||||
|
@ -136,7 +131,7 @@ FindResourceExW (
|
|||
return NULL;
|
||||
}
|
||||
else
|
||||
nType = lpType;
|
||||
nType = (ULONG)lpType;
|
||||
|
||||
Status = LdrFindResource_U(hModule,&ResourceDataEntry,lpName, nType,wLanguage);
|
||||
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
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -30,7 +30,10 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CreateProcessA (
|
||||
LPCSTR lpApplicationName,
|
||||
LPSTR lpCommandLine,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
|
@ -39,7 +42,8 @@ WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
|||
LPVOID lpEnvironment,
|
||||
LPCSTR lpCurrentDirectory,
|
||||
LPSTARTUPINFOA lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation)
|
||||
LPPROCESS_INFORMATION lpProcessInformation
|
||||
)
|
||||
/*
|
||||
* FUNCTION: The CreateProcess function creates a new process and its
|
||||
* primary thread. The new process executes the specified executable file
|
||||
|
@ -57,34 +61,65 @@ WINBOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
|
|||
* lpProcessInformation = Pointer to process information
|
||||
*/
|
||||
{
|
||||
WCHAR ApplicationNameW[MAX_PATH];
|
||||
WCHAR CommandLineW[MAX_PATH];
|
||||
WCHAR CurrentDirectoryW[MAX_PATH];
|
||||
PWSTR PApplicationNameW;
|
||||
PWSTR PCommandLineW;
|
||||
PWSTR PCurrentDirectoryW;
|
||||
UNICODE_STRING ApplicationNameU;
|
||||
UNICODE_STRING CurrentDirectoryU;
|
||||
UNICODE_STRING CommandLineU;
|
||||
ANSI_STRING ApplicationName;
|
||||
ANSI_STRING CurrentDirectory;
|
||||
ANSI_STRING CommandLine;
|
||||
WINBOOL Result;
|
||||
|
||||
DPRINT("CreateProcessA\n");
|
||||
|
||||
PApplicationNameW = InternalAnsiToUnicode(ApplicationNameW,
|
||||
lpApplicationName,
|
||||
MAX_PATH);
|
||||
PCommandLineW = InternalAnsiToUnicode(CommandLineW,
|
||||
lpCommandLine,
|
||||
MAX_PATH);
|
||||
PCurrentDirectoryW = InternalAnsiToUnicode(CurrentDirectoryW,
|
||||
lpCurrentDirectory,
|
||||
MAX_PATH);
|
||||
return CreateProcessW(PApplicationNameW,
|
||||
PCommandLineW,
|
||||
RtlInitAnsiString (&CommandLine,
|
||||
lpCommandLine);
|
||||
RtlInitAnsiString (&ApplicationName,
|
||||
(LPSTR)lpApplicationName);
|
||||
RtlInitAnsiString (&CurrentDirectory,
|
||||
(LPSTR)lpCurrentDirectory);
|
||||
|
||||
/* convert ansi (or oem) strings to unicode */
|
||||
if (bIsFileApiAnsi)
|
||||
{
|
||||
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,
|
||||
lpThreadAttributes,
|
||||
bInheritHandles,
|
||||
dwCreationFlags,
|
||||
lpEnvironment,
|
||||
PCurrentDirectoryW,
|
||||
CurrentDirectoryU.Buffer,
|
||||
(LPSTARTUPINFOW)lpStartupInfo,
|
||||
lpProcessInformation);
|
||||
|
||||
RtlFreeUnicodeString (&ApplicationNameU);
|
||||
RtlFreeUnicodeString (&CommandLineU);
|
||||
RtlFreeUnicodeString (&CurrentDirectoryU);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
#define STACK_TOP (0xb0000000)
|
||||
|
@ -442,6 +477,11 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
|
|||
*/
|
||||
|
||||
hSection = KlMapFile (lpApplicationName, lpCommandLine);
|
||||
if (hSection == NULL)
|
||||
{
|
||||
RtlDestroyProcessParameters (Ppb);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
* 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
|
||||
STDCALL
|
||||
OpenProcess (
|
||||
|
@ -265,14 +237,23 @@ WaitForInputIdle (
|
|||
}
|
||||
|
||||
|
||||
VOID STDCALL Sleep (DWORD dwMilliseconds)
|
||||
VOID
|
||||
STDCALL
|
||||
Sleep (
|
||||
DWORD dwMilliseconds
|
||||
)
|
||||
{
|
||||
SleepEx (dwMilliseconds, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD STDCALL SleepEx(DWORD dwMilliseconds,
|
||||
BOOL bAlertable)
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
SleepEx (
|
||||
DWORD dwMilliseconds,
|
||||
BOOL bAlertable
|
||||
)
|
||||
{
|
||||
TIME Interval;
|
||||
NTSTATUS errCode;
|
||||
|
@ -412,8 +393,7 @@ FlushInstructionCache (
|
|||
errCode = NtFlushInstructionCache(
|
||||
hProcess,
|
||||
(PVOID) lpBaseAddress,
|
||||
dwSize
|
||||
);
|
||||
dwSize);
|
||||
if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
|
@ -429,10 +409,8 @@ ExitProcess (
|
|||
UINT uExitCode
|
||||
)
|
||||
{
|
||||
NtTerminateProcess(
|
||||
NtCurrentProcess(),
|
||||
uExitCode
|
||||
);
|
||||
NtTerminateProcess (NtCurrentProcess (),
|
||||
uExitCode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,6 +422,7 @@ TerminateProcess (
|
|||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
|
||||
errCode = NtTerminateProcess(hProcess, uExitCode);
|
||||
if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
|
@ -453,6 +432,7 @@ TerminateProcess (
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
FatalAppExitA (
|
||||
|
@ -460,18 +440,20 @@ FatalAppExitA (
|
|||
LPCSTR lpMessageText
|
||||
)
|
||||
{
|
||||
WCHAR MessageTextW[MAX_PATH];
|
||||
UINT i;
|
||||
i = 0;
|
||||
while ((*lpMessageText)!=0 && i < 35)
|
||||
{
|
||||
MessageTextW[i] = *lpMessageText;
|
||||
lpMessageText++;
|
||||
i++;
|
||||
}
|
||||
MessageTextW[i] = 0;
|
||||
UNICODE_STRING MessageTextU;
|
||||
ANSI_STRING MessageText;
|
||||
|
||||
return FatalAppExitW(uAction,MessageTextW);
|
||||
RtlInitAnsiString (&MessageText,
|
||||
(LPSTR)lpMessageText);
|
||||
|
||||
RtlAnsiStringToUnicodeString (&MessageTextU,
|
||||
&MessageText,
|
||||
TRUE);
|
||||
|
||||
FatalAppExitW (uAction,
|
||||
MessageTextU.Buffer);
|
||||
|
||||
RtlFreeUnicodeString (&MessageTextU);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue