mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 11:53:16 +00:00
Put LoadString code back that was removed by someone...
svn path=/trunk/; revision=1984
This commit is contained in:
parent
a49c07b8f2
commit
16588f8362
3 changed files with 63 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile_rex,v 1.17 2001/06/12 17:35:43 chorns Exp $
|
# $Id: makefile_rex,v 1.18 2001/06/18 03:05:54 phreak Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -16,7 +16,8 @@ MISC_OBJECTS = \
|
||||||
misc/sprintf.o \
|
misc/sprintf.o \
|
||||||
misc/stubs.o \
|
misc/stubs.o \
|
||||||
misc/win32k.o \
|
misc/win32k.o \
|
||||||
misc/winsta.o
|
misc/winsta.o \
|
||||||
|
misc/resources.o
|
||||||
|
|
||||||
WINDOWS_OBJECTS = \
|
WINDOWS_OBJECTS = \
|
||||||
windows/class.o \
|
windows/class.o \
|
||||||
|
|
59
reactos/lib/user32/misc/resources.c
Normal file
59
reactos/lib/user32/misc/resources.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include <kernel32/error.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
STDCALL
|
||||||
|
LoadStringA( HINSTANCE hInstance,
|
||||||
|
UINT uID,
|
||||||
|
LPSTR lpBuffer,
|
||||||
|
int nBufferMax)
|
||||||
|
{
|
||||||
|
HRSRC rsc;
|
||||||
|
PBYTE ptr;
|
||||||
|
int len;
|
||||||
|
int count, dest = uID % 16;
|
||||||
|
PWSTR pwstr;
|
||||||
|
UNICODE_STRING UString;
|
||||||
|
ANSI_STRING AString;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
rsc = FindResource( (HMODULE)hInstance,
|
||||||
|
MAKEINTRESOURCE( (uID / 16) + 1 ),
|
||||||
|
RT_STRING );
|
||||||
|
if( rsc == NULL )
|
||||||
|
return 0;
|
||||||
|
// get pointer to string table
|
||||||
|
ptr = (PBYTE)LoadResource( (HMODULE)hInstance, rsc );
|
||||||
|
if( ptr == NULL )
|
||||||
|
return 0;
|
||||||
|
for( count = 0; count <= dest; count++ )
|
||||||
|
{
|
||||||
|
// walk each of the 16 string slots in the string table
|
||||||
|
len = (*(USHORT *)ptr) * 2; // length is in unicode chars, convert to bytes
|
||||||
|
ptr += 2; // first 2 bytes are length, string follows
|
||||||
|
pwstr = (PWSTR)ptr;
|
||||||
|
ptr += len;
|
||||||
|
}
|
||||||
|
if( !len )
|
||||||
|
return 0; // zero means no string is there
|
||||||
|
// convert unitocde to ansi, and copy string to caller buffer
|
||||||
|
UString.Length = UString.MaximumLength = len;
|
||||||
|
UString.Buffer = pwstr;
|
||||||
|
memset( &AString, 0, sizeof AString );
|
||||||
|
Status = RtlUnicodeStringToAnsiString( &AString, &UString, TRUE );
|
||||||
|
if( !NT_SUCCESS( Status ) )
|
||||||
|
{
|
||||||
|
SetLastErrorByStatus( Status );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
nBufferMax--; // save room for the null
|
||||||
|
if( nBufferMax > AString.Length )
|
||||||
|
nBufferMax = AString.Length;
|
||||||
|
memcpy( lpBuffer, AString.Buffer, nBufferMax );
|
||||||
|
lpBuffer[nBufferMax] = 0;
|
||||||
|
RtlFreeAnsiString( &AString );
|
||||||
|
return nBufferMax;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: stubs.c,v 1.3 2001/06/12 17:35:45 chorns Exp $
|
/* $Id: stubs.c,v 1.4 2001/06/18 03:05:54 phreak Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -2948,17 +2948,6 @@ LoadMenuW(
|
||||||
return (HMENU)0;
|
return (HMENU)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
STDCALL
|
|
||||||
LoadStringA(
|
|
||||||
HINSTANCE hInstance,
|
|
||||||
UINT uID,
|
|
||||||
LPSTR lpBuffer,
|
|
||||||
int nBufferMax)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
STDCALL
|
STDCALL
|
||||||
LoadStringW(
|
LoadStringW(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue