mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[NEWINFLIB]
- Change Unicode string functions from wcs* to str*W because glibc (Linux build) provides the wcs* functions but they use a wchar_t size of 32 bits instead of the required 16 bits. - Add a str*W to wcs* wrapper (infrosrtl.c) in order to use the wcs* function for the WIN32 build. - Add required str*W functions to the host library. ATTENTION: This might break the build bot although it has been tested on Windows and Linux!!! svn path=/trunk/; revision=47071
This commit is contained in:
parent
06ef98d273
commit
d771ba8ec6
10 changed files with 138 additions and 51 deletions
|
@ -18,6 +18,17 @@ SIZE_T utf16_wcslen(PCWSTR str)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SIZE_T strlenW(PCWSTR str)
|
||||||
|
{
|
||||||
|
SIZE_T i;
|
||||||
|
|
||||||
|
for(i = 0; str[i]; i++);
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PWSTR utf16_wcschr(PWSTR str, WCHAR c)
|
PWSTR utf16_wcschr(PWSTR str, WCHAR c)
|
||||||
{
|
{
|
||||||
SIZE_T i;
|
SIZE_T i;
|
||||||
|
@ -30,6 +41,18 @@ PWSTR utf16_wcschr(PWSTR str, WCHAR c)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PWSTR strchrW(PWSTR str, WCHAR c)
|
||||||
|
{
|
||||||
|
SIZE_T i;
|
||||||
|
|
||||||
|
for(i = 0; str[i] && str[i] != c; i++);
|
||||||
|
|
||||||
|
if(str[i])
|
||||||
|
return &str[i];
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
INT utf16_wcsncmp(PCWSTR string1, PCWSTR string2, size_t count)
|
INT utf16_wcsncmp(PCWSTR string1, PCWSTR string2, size_t count)
|
||||||
{
|
{
|
||||||
while(count--)
|
while(count--)
|
||||||
|
@ -46,3 +69,20 @@ INT utf16_wcsncmp(PCWSTR string1, PCWSTR string2, size_t count)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT strncmpW(PCWSTR string1, PCWSTR string2, size_t count)
|
||||||
|
{
|
||||||
|
while(count--)
|
||||||
|
{
|
||||||
|
if(*string1 != *string2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if(*string1 == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
string1++;
|
||||||
|
string2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -28,20 +28,13 @@
|
||||||
#define INF_STATUS_BUFFER_OVERFLOW E2BIG
|
#define INF_STATUS_BUFFER_OVERFLOW E2BIG
|
||||||
#define INF_SUCCESS(x) (0 == (x))
|
#define INF_SUCCESS(x) (0 == (x))
|
||||||
|
|
||||||
typedef char TCHAR, *PTCHAR, *PTSTR;
|
|
||||||
typedef const TCHAR *PCTSTR;
|
|
||||||
|
|
||||||
#define _T(x) x
|
|
||||||
#define _tcsicmp strcasecmp
|
|
||||||
#define _tcslen strlen
|
|
||||||
#define _tcscpy strcpy
|
|
||||||
#define _tcstoul strtoul
|
|
||||||
#define _tcstol strtol
|
|
||||||
#define STRFMT "%s"
|
#define STRFMT "%s"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
NTSTATUS NTAPI RtlMultiByteToUnicodeN(IN PWCHAR UnicodeString,
|
||||||
#define strcasecmp _stricmp
|
IN ULONG UnicodeSize, IN PULONG ResultSize, IN PCSTR MbString, IN ULONG MbSize);
|
||||||
#endif
|
|
||||||
|
BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf );
|
||||||
|
|
||||||
|
|
||||||
#define IS_TEXT_UNICODE_ASCII16 1
|
#define IS_TEXT_UNICODE_ASCII16 1
|
||||||
#define IS_TEXT_UNICODE_REVERSE_ASCII16 16
|
#define IS_TEXT_UNICODE_REVERSE_ASCII16 16
|
||||||
|
@ -69,10 +62,18 @@ typedef const TCHAR *PCTSTR;
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ndk/ntndk.h>
|
#include <ndk/ntndk.h>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
extern PVOID InfpHeap;
|
extern PVOID InfpHeap;
|
||||||
|
|
||||||
|
INT isspaceW(WCHAR c);
|
||||||
|
INT strlenW(PCWSTR s);
|
||||||
|
PWSTR strcpyW(PWSTR d, PCWSTR s);
|
||||||
|
PWSTR strncpyW(PWSTR d, PCWSTR s, SIZE_T c);
|
||||||
|
INT strcmpiW(PCWSTR s1, PCWSTR s2);
|
||||||
|
LONG strtolW(PCWSTR s, PWSTR *e, INT r);
|
||||||
|
ULONG strtoulW(PCWSTR s, PWSTR *e, INT r);
|
||||||
|
|
||||||
|
|
||||||
#define FREE(Area) RtlFreeHeap(InfpHeap, 0, (Area))
|
#define FREE(Area) RtlFreeHeap(InfpHeap, 0, (Area))
|
||||||
#define MALLOC(Size) RtlAllocateHeap(InfpHeap, 0, (Size))
|
#define MALLOC(Size) RtlAllocateHeap(InfpHeap, 0, (Size))
|
||||||
#define ZEROMEMORY(Area, Size) RtlZeroMemory((Area), (Size))
|
#define ZEROMEMORY(Area, Size) RtlZeroMemory((Area), (Size))
|
||||||
|
|
|
@ -154,7 +154,7 @@ InfpFindSection(PINFCACHE Cache,
|
||||||
Section = Cache->FirstSection;
|
Section = Cache->FirstSection;
|
||||||
while (Section != NULL)
|
while (Section != NULL)
|
||||||
{
|
{
|
||||||
if (_wcsicmp (Section->Name, Name) == 0)
|
if (strcmpiW(Section->Name, Name) == 0)
|
||||||
{
|
{
|
||||||
return Section;
|
return Section;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ InfpAddSection(PINFCACHE Cache,
|
||||||
|
|
||||||
/* Allocate and initialize the new section */
|
/* Allocate and initialize the new section */
|
||||||
Size = (ULONG)FIELD_OFFSET(INFCACHESECTION,
|
Size = (ULONG)FIELD_OFFSET(INFCACHESECTION,
|
||||||
Name[wcslen (Name) + 1]);
|
Name[strlenW(Name) + 1]);
|
||||||
Section = (PINFCACHESECTION)MALLOC(Size);
|
Section = (PINFCACHESECTION)MALLOC(Size);
|
||||||
if (Section == NULL)
|
if (Section == NULL)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,7 @@ InfpAddSection(PINFCACHE Cache,
|
||||||
Size);
|
Size);
|
||||||
|
|
||||||
/* Copy section name */
|
/* Copy section name */
|
||||||
wcscpy (Section->Name, Name);
|
strcpyW(Section->Name, Name);
|
||||||
|
|
||||||
/* Append section */
|
/* Append section */
|
||||||
if (Cache->FirstSection == NULL)
|
if (Cache->FirstSection == NULL)
|
||||||
|
@ -266,14 +266,14 @@ InfpAddKeyToLine(PINFCACHELINE Line,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Line->Key = (PWCHAR)MALLOC((wcslen(Key) + 1) * sizeof(WCHAR));
|
Line->Key = (PWCHAR)MALLOC((strlenW(Key) + 1) * sizeof(WCHAR));
|
||||||
if (Line->Key == NULL)
|
if (Line->Key == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("MALLOC() failed\n");
|
DPRINT1("MALLOC() failed\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy(Line->Key, Key);
|
strcpyW(Line->Key, Key);
|
||||||
|
|
||||||
return (PVOID)Line->Key;
|
return (PVOID)Line->Key;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ InfpAddFieldToLine(PINFCACHELINE Line,
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
Size = (ULONG)FIELD_OFFSET(INFCACHEFIELD,
|
Size = (ULONG)FIELD_OFFSET(INFCACHEFIELD,
|
||||||
Data[wcslen(Data) + 1]);
|
Data[strlenW(Data) + 1]);
|
||||||
Field = (PINFCACHEFIELD)MALLOC(Size);
|
Field = (PINFCACHEFIELD)MALLOC(Size);
|
||||||
if (Field == NULL)
|
if (Field == NULL)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +296,7 @@ InfpAddFieldToLine(PINFCACHELINE Line,
|
||||||
}
|
}
|
||||||
ZEROMEMORY (Field,
|
ZEROMEMORY (Field,
|
||||||
Size);
|
Size);
|
||||||
wcscpy (Field->Data, Data);
|
strcpyW(Field->Data, Data);
|
||||||
|
|
||||||
/* Append key */
|
/* Append key */
|
||||||
if (Line->FirstField == NULL)
|
if (Line->FirstField == NULL)
|
||||||
|
@ -325,7 +325,7 @@ InfpFindKeyLine(PINFCACHESECTION Section,
|
||||||
Line = Section->FirstLine;
|
Line = Section->FirstLine;
|
||||||
while (Line != NULL)
|
while (Line != NULL)
|
||||||
{
|
{
|
||||||
if (Line->Key != NULL && _wcsicmp (Line->Key, Key) == 0)
|
if (Line->Key != NULL && strcmpiW(Line->Key, Key) == 0)
|
||||||
{
|
{
|
||||||
return Line;
|
return Line;
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ static const WCHAR *line_start_state( struct parser *parser, const WCHAR *pos )
|
||||||
return p + 1;
|
return p + 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!iswspace(*p))
|
if (!isspaceW(*p))
|
||||||
{
|
{
|
||||||
parser->start = p;
|
parser->start = p;
|
||||||
set_state( parser, KEY_NAME );
|
set_state( parser, KEY_NAME );
|
||||||
|
@ -595,7 +595,7 @@ static const WCHAR *key_name_state( struct parser *parser, const WCHAR *pos )
|
||||||
set_state( parser, EOL_BACKSLASH );
|
set_state( parser, EOL_BACKSLASH );
|
||||||
return p;
|
return p;
|
||||||
default:
|
default:
|
||||||
if (!iswspace(*p)) token_end = p + 1;
|
if (!isspaceW(*p)) token_end = p + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
push_token( parser, p );
|
push_token( parser, p );
|
||||||
|
@ -647,7 +647,7 @@ static const WCHAR *value_name_state( struct parser *parser, const WCHAR *pos )
|
||||||
set_state( parser, EOL_BACKSLASH );
|
set_state( parser, EOL_BACKSLASH );
|
||||||
return p;
|
return p;
|
||||||
default:
|
default:
|
||||||
if (!isspace(*p)) token_end = p + 1;
|
if (!isspaceW(*p)) token_end = p + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
push_token( parser, p );
|
push_token( parser, p );
|
||||||
|
@ -692,7 +692,7 @@ static const WCHAR *eol_backslash_state( struct parser *parser, const WCHAR *pos
|
||||||
return p + 1;
|
return p + 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (iswspace(*p))
|
if (isspaceW(*p))
|
||||||
continue;
|
continue;
|
||||||
push_token( parser, p );
|
push_token( parser, p );
|
||||||
pop_state( parser );
|
pop_state( parser );
|
||||||
|
@ -749,7 +749,7 @@ static const WCHAR *leading_spaces_state( struct parser *parser, const WCHAR *po
|
||||||
set_state( parser, EOL_BACKSLASH );
|
set_state( parser, EOL_BACKSLASH );
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
if (!iswspace(*p))
|
if (!isspaceW(*p))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parser->start = p;
|
parser->start = p;
|
||||||
|
@ -770,7 +770,7 @@ static const WCHAR *trailing_spaces_state( struct parser *parser, const WCHAR *p
|
||||||
set_state( parser, EOL_BACKSLASH );
|
set_state( parser, EOL_BACKSLASH );
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
if (!iswspace(*p))
|
if (!isspaceW(*p))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pop_state( parser );
|
pop_state( parser );
|
||||||
|
|
|
@ -41,7 +41,7 @@ InfpGetSubstitutionString(PINFCACHE Inf,
|
||||||
return &percent;
|
return &percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcsncpy(ValueName, str, *len);
|
strncpyW(ValueName, str, *len);
|
||||||
ValueName[*len] = 0;
|
ValueName[*len] = 0;
|
||||||
|
|
||||||
DPRINT("Value name: %S\n", ValueName);
|
DPRINT("Value name: %S\n", ValueName);
|
||||||
|
@ -94,7 +94,7 @@ InfpGetSubstitutionString(PINFCACHE Inf,
|
||||||
|
|
||||||
if (Status == STATUS_SUCCESS)
|
if (Status == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
*len = wcslen(Data);
|
*len = strlenW(Data);
|
||||||
DPRINT("Substitute: %S Length: %ul\n", Data, *len);
|
DPRINT("Substitute: %S Length: %ul\n", Data, *len);
|
||||||
return Data;
|
return Data;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ InfpFindFirstMatchLine(PINFCONTEXT ContextIn,
|
||||||
CacheLine = ((PINFCACHESECTION)(ContextIn->Section))->FirstLine;
|
CacheLine = ((PINFCACHESECTION)(ContextIn->Section))->FirstLine;
|
||||||
while (CacheLine != NULL)
|
while (CacheLine != NULL)
|
||||||
{
|
{
|
||||||
if (CacheLine->Key != NULL && _wcsicmp (CacheLine->Key, Key) == 0)
|
if (CacheLine->Key != NULL && strcmpiW (CacheLine->Key, Key) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ContextIn != ContextOut)
|
if (ContextIn != ContextOut)
|
||||||
|
@ -289,7 +289,7 @@ InfpFindNextMatchLine(PINFCONTEXT ContextIn,
|
||||||
CacheLine = (PINFCACHELINE)ContextIn->Line;
|
CacheLine = (PINFCACHELINE)ContextIn->Line;
|
||||||
while (CacheLine != NULL)
|
while (CacheLine != NULL)
|
||||||
{
|
{
|
||||||
if (CacheLine->Key != NULL && _wcsicmp (CacheLine->Key, Key) == 0)
|
if (CacheLine->Key != NULL && strcmpiW (CacheLine->Key, Key) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ContextIn != ContextOut)
|
if (ContextIn != ContextOut)
|
||||||
|
@ -329,7 +329,7 @@ InfpGetLineCount(HINF InfHandle,
|
||||||
while (CacheSection != NULL)
|
while (CacheSection != NULL)
|
||||||
{
|
{
|
||||||
/* Are the section names the same? */
|
/* Are the section names the same? */
|
||||||
if (_wcsicmp(CacheSection->Name, Section) == 0)
|
if (strcmpiW(CacheSection->Name, Section) == 0)
|
||||||
{
|
{
|
||||||
return CacheSection->LineCount;
|
return CacheSection->LineCount;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ InfpGetBinaryField(PINFCONTEXT Context,
|
||||||
Ptr = ReturnBuffer;
|
Ptr = ReturnBuffer;
|
||||||
while (CacheField != NULL)
|
while (CacheField != NULL)
|
||||||
{
|
{
|
||||||
*Ptr = (UCHAR)wcstoul(CacheField->Data, NULL, 16);
|
*Ptr = (UCHAR)strtoulW(CacheField->Data, NULL, 16);
|
||||||
|
|
||||||
Ptr++;
|
Ptr++;
|
||||||
CacheField = CacheField->Next;
|
CacheField = CacheField->Next;
|
||||||
|
@ -450,7 +450,7 @@ InfpGetIntField(PINFCONTEXT Context,
|
||||||
Ptr = CacheField->Data;
|
Ptr = CacheField->Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
*IntegerValue = (LONG)wcstol(Ptr, NULL, 0);
|
*IntegerValue = (LONG)strtolW(Ptr, NULL, 0);
|
||||||
|
|
||||||
return INF_STATUS_SUCCESS;
|
return INF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ InfpGetMultiSzField(PINFCONTEXT Context,
|
||||||
Size = 0;
|
Size = 0;
|
||||||
while (FieldPtr != NULL)
|
while (FieldPtr != NULL)
|
||||||
{
|
{
|
||||||
Size += ((ULONG)wcslen (FieldPtr->Data) + 1);
|
Size += ((ULONG)strlenW(FieldPtr->Data) + 1);
|
||||||
FieldPtr = FieldPtr->Next;
|
FieldPtr = FieldPtr->Next;
|
||||||
}
|
}
|
||||||
Size++;
|
Size++;
|
||||||
|
@ -511,9 +511,9 @@ InfpGetMultiSzField(PINFCONTEXT Context,
|
||||||
FieldPtr = CacheField;
|
FieldPtr = CacheField;
|
||||||
while (FieldPtr != NULL)
|
while (FieldPtr != NULL)
|
||||||
{
|
{
|
||||||
Size = (ULONG)wcslen (FieldPtr->Data) + 1;
|
Size = (ULONG)strlenW(FieldPtr->Data) + 1;
|
||||||
|
|
||||||
wcscpy (Ptr, FieldPtr->Data);
|
strcpyW(Ptr, FieldPtr->Data);
|
||||||
|
|
||||||
Ptr = Ptr + Size;
|
Ptr = Ptr + Size;
|
||||||
FieldPtr = FieldPtr->Next;
|
FieldPtr = FieldPtr->Next;
|
||||||
|
@ -565,7 +565,7 @@ InfpGetStringField(PINFCONTEXT Context,
|
||||||
Ptr = CacheField->Data;
|
Ptr = CacheField->Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size = (ULONG)wcslen (Ptr) + 1;
|
// Size = (ULONG)strlenW(Ptr) + 1;
|
||||||
Size = InfpSubstituteString(Context->Inf,
|
Size = InfpSubstituteString(Context->Inf,
|
||||||
Ptr,
|
Ptr,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -579,7 +579,7 @@ InfpGetStringField(PINFCONTEXT Context,
|
||||||
if (ReturnBufferSize <= Size)
|
if (ReturnBufferSize <= Size)
|
||||||
return INF_STATUS_BUFFER_OVERFLOW;
|
return INF_STATUS_BUFFER_OVERFLOW;
|
||||||
|
|
||||||
// wcscpy (ReturnBuffer, Ptr);
|
// strcpyW(ReturnBuffer, Ptr);
|
||||||
InfpSubstituteString(Context->Inf,
|
InfpSubstituteString(Context->Inf,
|
||||||
Ptr,
|
Ptr,
|
||||||
ReturnBuffer,
|
ReturnBuffer,
|
||||||
|
|
|
@ -14,12 +14,6 @@ extern "C" {
|
||||||
|
|
||||||
#include "infcommon.h"
|
#include "infcommon.h"
|
||||||
|
|
||||||
extern NTSTATUS NTAPI RtlMultiByteToUnicodeN(IN PWCHAR UnicodeString,
|
|
||||||
IN ULONG UnicodeSize, IN PULONG ResultSize, IN PCSTR MbString, IN ULONG MbSize);
|
|
||||||
|
|
||||||
extern BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf );
|
|
||||||
|
|
||||||
|
|
||||||
extern int InfHostOpenBufferedFile(PHINF InfHandle,
|
extern int InfHostOpenBufferedFile(PHINF InfHandle,
|
||||||
void *Buffer,
|
void *Buffer,
|
||||||
ULONG BufferSize,
|
ULONG BufferSize,
|
||||||
|
|
|
@ -115,7 +115,7 @@ RtlIsTextUnicode( PVOID buf, INT len, INT *pf )
|
||||||
{
|
{
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if (wcschr(std_control_chars, s[i]))
|
if (strchrW(std_control_chars, s[i]))
|
||||||
{
|
{
|
||||||
out_flags |= IS_TEXT_UNICODE_CONTROLS;
|
out_flags |= IS_TEXT_UNICODE_CONTROLS;
|
||||||
break;
|
break;
|
||||||
|
@ -127,7 +127,7 @@ RtlIsTextUnicode( PVOID buf, INT len, INT *pf )
|
||||||
{
|
{
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if (wcschr(byterev_control_chars, s[i]))
|
if (strchrW(byterev_control_chars, s[i]))
|
||||||
{
|
{
|
||||||
out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;
|
out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<file>infrosgen.c</file>
|
<file>infrosgen.c</file>
|
||||||
<file>infrosget.c</file>
|
<file>infrosget.c</file>
|
||||||
<file>infrosput.c</file>
|
<file>infrosput.c</file>
|
||||||
|
<file>infrosrtl.c</file>
|
||||||
</module>
|
</module>
|
||||||
<module name="newinflibhost" type="hoststaticlibrary" allowwarnings="true">
|
<module name="newinflibhost" type="hoststaticlibrary" allowwarnings="true">
|
||||||
<include base="newinflibhost">.</include>
|
<include base="newinflibhost">.</include>
|
||||||
|
|
|
@ -37,7 +37,7 @@ Output(POUTPUTBUFFER OutBuf, PCWSTR Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Doesn't fit? */
|
/* Doesn't fit? */
|
||||||
Length = (ULONG)wcslen(Text) * sizeof(WCHAR);
|
Length = (ULONG)strlenW(Text) * sizeof(WCHAR);
|
||||||
if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status))
|
if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status))
|
||||||
{
|
{
|
||||||
DPRINT("Out of free space. TotalSize %u FreeSize %u Length %u\n",
|
DPRINT("Out of free space. TotalSize %u FreeSize %u Length %u\n",
|
||||||
|
|
|
@ -64,13 +64,13 @@ InfWriteFile(HINF InfHandle,
|
||||||
HeaderBuffer = MALLOC(HeaderBufferSize);
|
HeaderBuffer = MALLOC(HeaderBufferSize);
|
||||||
if (NULL != HeaderBuffer)
|
if (NULL != HeaderBuffer)
|
||||||
{
|
{
|
||||||
wcscpy(HeaderBuffer, L"; ");
|
strcpyW(HeaderBuffer, L"; ");
|
||||||
for (Index = 0; Index < HeaderComment->Length / sizeof(WCHAR); Index++)
|
for (Index = 0; Index < HeaderComment->Length / sizeof(WCHAR); Index++)
|
||||||
{
|
{
|
||||||
HeaderBuffer[2 + Index] = HeaderComment->Buffer[Index];
|
HeaderBuffer[2 + Index] = HeaderComment->Buffer[Index];
|
||||||
}
|
}
|
||||||
wcscpy(HeaderBuffer + (2 + HeaderComment->Length / sizeof(WCHAR)),
|
strcpyW(HeaderBuffer + (2 + HeaderComment->Length / sizeof(WCHAR)),
|
||||||
L"\r\n\r\n");
|
L"\r\n\r\n");
|
||||||
NtWriteFile(FileHandle,
|
NtWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
51
reactos/lib/newinflib/infrosrtl.c
Normal file
51
reactos/lib/newinflib/infrosrtl.c
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: .inf file parser
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* PROGRAMMER: Eric Kohl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include "inflib.h"
|
||||||
|
#include "infhost.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
INT isspaceW(WCHAR c)
|
||||||
|
{
|
||||||
|
return iswspace(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
INT strlenW(PCWSTR s)
|
||||||
|
{
|
||||||
|
return wcslen(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
PWSTR strcpyW(PWSTR d, PCWSTR s)
|
||||||
|
{
|
||||||
|
return wcscpy(d, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
PWSTR strncpyW(PWSTR d, PCWSTR s, SIZE_T c)
|
||||||
|
{
|
||||||
|
return wcsncpy(d, s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
INT strcmpiW(PCWSTR s1, PCWSTR s2)
|
||||||
|
{
|
||||||
|
return wcsicmp(s1, s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG strtolW(PCWSTR s, PWSTR *e, INT r)
|
||||||
|
{
|
||||||
|
return wcstol(s, e, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG strtoulW(PCWSTR s, PWSTR *e, INT r)
|
||||||
|
{
|
||||||
|
return wcstoul(s, e, r);
|
||||||
|
}
|
Loading…
Reference in a new issue