diff --git a/reactos/lib/kernel32/misc/env.c b/reactos/lib/kernel32/misc/env.c index 00eac4f3751..abaac3f0f2c 100644 --- a/reactos/lib/kernel32/misc/env.c +++ b/reactos/lib/kernel32/misc/env.c @@ -66,7 +66,7 @@ GetEnvironmentVariableW( while (i < nEnvVar) { - if ( wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { + if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { lstrcpynW(lpBuffer,Environment[i].Value.Buffer,min(nSize,Environment[i].Value.Length/sizeof(WCHAR))); return lstrlenW(Environment[i].Value.Buffer); @@ -130,7 +130,7 @@ SetEnvironmentVariableW( while (i < nEnvVar) { - if ( wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { + if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { if ( lpValue != NULL ) { lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR))); return TRUE; diff --git a/reactos/lib/kernel32/string/lstring.c b/reactos/lib/kernel32/string/lstring.c index b8f72bfece9..f17b44fdb33 100644 --- a/reactos/lib/kernel32/string/lstring.c +++ b/reactos/lib/kernel32/string/lstring.c @@ -89,8 +89,7 @@ lstrcmpiW( LPCWSTR lpString2 ) { - return wcsicmp(lpString1,lpString2); - + return _wcsicmp(lpString1,lpString2); } LPWSTR @@ -135,8 +134,3 @@ lstrlenW( } - - - - - diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 14e68979900..095ecdac589 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -421,34 +421,59 @@ ZwWriteVirtualMemory@20 ZwW32Call@20 ZwYieldExecution@0 RtlAllocateHeap@12 +RtlAnsiStringToUnicodeSize +RtlAnsiStringToUnicodeString +RtlAppendUnicodeStringToString +RtlAppendUnicodeToString +RtlCharToInteger RtlCreateHeap@24 RtlCompactHeap@8 +RtlCompareString +RtlCompareUnicodeString +RtlCopyString +RtlCopyUnicodeString RtlDestroyHeap@4 -RtlFreeHeap@12 -RtlGetProcessHeap@0 -RtlLockHeap@4 -RtlReAllocHeap@16 -RtlSizeHeap@12 -RtlUnlockHeap@4 -RtlValidateHeap@12 -RtlAnsiStringToUnicodeString RtlEnlargedIntegerMultiply RtlEnlargedUnsignedMultiply +RtlEqualString +RtlEqualUnicodeString RtlExtendedIntegerMultiply RtlFreeAnsiString +RtlFreeHeap@12 RtlFreeUnicodeString +RtlGetProcessHeap@0 RtlInitAnsiString +RtlInitString RtlInitUnicodeString +RtlIntegerToUnicodeString RtlLargeIntegerAdd RtlLargeIntegerDivide RtlLengthSecurityDescriptor +RtlLockHeap@4 RtlNtStatusToDosError +RtlReAllocHeap@16 +RtlSizeHeap@12 +RtlUnlockHeap@4 +RtlUnicodeStringToAnsiSize +RtlUnicodeStringToAnsiString +RtlUnicodeStringToInteger +RtlUpcaseString +RtlUpcaseUnicodeString +RtlValidateHeap@12 +_memccpy +_memicmp _splitpath _strcmpi _stricmp _strlwr _strnicmp _strupr +_tolower +_toupper +_wcsicmp +_wcslwr +_wcsnicmp +_wcsupr atoi atol isalpha @@ -456,11 +481,14 @@ isalnum iscntrl isdigit isgraph +islower isprint ispunct isspace isupper -iswlower +isxdigit +memchr +memcmp memcpy memmove memset @@ -470,25 +498,32 @@ strchr strcmp strcpy strcspn +strlen strncat strncmp strncpy -strlen +strpbrk strrchr +strspn strstr strtol strtoul tolower toupper +towlower towupper +vsprintf wcscat wcschr wcscmp wcscpy -wcsncpy +wcscspn wcslen +wcsncat +wcsncmp +wcsncpy +wcspbrk wcsrchr -wcsicmp -wcsnicmp -vsprintf +wcsspn +wcsstr LdrMapNTDllForProcess diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index 3ee58486831..d3427bec2de 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -421,34 +421,59 @@ ZwWriteVirtualMemory=ZwWriteVirtualMemory@20 ZwW32Call=ZwW32Call@20 ZwYieldExecution=ZwYieldExecution@0 RtlAllocateHeap=RtlAllocateHeap@12 +RtlAnsiStringToUnicodeSize +RtlAnsiStringToUnicodeString +RtlAppendUnicodeStringToString +RtlAppendUnicodeToString +RtlCharToInteger RtlCreateHeap=RtlCreateHeap@24 RtlCompactHeap=RtlCompactHeap@8 +RtlCompareString +RtlCompareUnicodeString +RtlCopyString +RtlCopyUnicodeString RtlDestroyHeap=RtlDestroyHeap@4 -RtlFreeHeap=RtlFreeHeap@12 -RtlGetProcessHeap=RtlGetProcessHeap@0 -RtlLockHeap=RtlLockHeap@4 -RtlReAllocHeap=RtlReAllocHeap@16 -RtlSizeHeap=RtlSizeHeap@12 -RtlUnlockHeap=RtlUnlockHeap@4 -RtlValidateHeap=RtlValidateHeap@12 -RtlAnsiStringToUnicodeString RtlEnlargedIntegerMultiply RtlEnlargedUnsignedMultiply +RtlEqualString +RtlEqualUnicodeString RtlExtendedIntegerMultiply RtlFreeAnsiString +RtlFreeHeap=RtlFreeHeap@12 RtlFreeUnicodeString +RtlGetProcessHeap=RtlGetProcessHeap@0 RtlInitAnsiString +RtlInitString RtlInitUnicodeString +RtlIntegerToUnicodeString RtlLargeIntegerAdd RtlLargeIntegerDivide RtlLengthSecurityDescriptor +RtlLockHeap=RtlLockHeap@4 RtlNtStatusToDosError +RtlReAllocHeap=RtlReAllocHeap@16 +RtlSizeHeap=RtlSizeHeap@12 +RtlUnlockHeap=RtlUnlockHeap@4 +RtlUnicodeStringToAnsiSize +RtlUnicodeStringToAnsiString +RtlUnicodeStringToInteger +RtlUpcaseString +RtlUpcaseUnicodeString +RtlValidateHeap=RtlValidateHeap@12 +_memccpy +_memicmp _splitpath _strcmpi _stricmp _strlwr _strnicmp _strupr +_tolower +_toupper +_wcsicmp +_wcslwr +_wcsnicmp +_wcsupr atoi atol isalpha @@ -456,11 +481,14 @@ isalnum iscntrl isdigit isgraph +islower isprint ispunct isspace isupper -iswlower +isxdigit +memchr +memcmp memcpy memmove memset @@ -470,25 +498,32 @@ strchr strcmp strcpy strcspn +strlen strncat strncmp strncpy -strlen +strpbrk strrchr +strspn strstr strtol strtoul tolower toupper +towlower towupper +vsprintf wcscat wcschr wcscmp wcscpy -wcsncpy +wcscspn wcslen +wcsncat +wcsncmp +wcsncpy +wcspbrk wcsrchr -wcsicmp -wcsnicmp -vsprintf +wcsspn +wcsstr LdrMapNTDllForProcess diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 5c112dbc4a3..05f4e4435af 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.20 1999/07/22 21:31:39 ekohl Exp $ +# $Id: makefile,v 1.21 1999/07/29 21:14:02 ekohl Exp $ # # ReactOS Operating System # @@ -27,12 +27,14 @@ RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \ STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \ stdlib/strtol.o stdlib/strtoul.o -STRING_OBJECTS = string/ctype.o string/memcpy.o string/memmove.o \ - string/memset.o string/strcat.o string/strchr.o \ - string/strcmp.o string/strcspn.o \ - string/strcpy.o string/stricmp.o string/strlen.o string/strlwr.o \ - string/strncat.o string/strncmp.o string/strncpy.o \ - string/strnicmp.o string/strnlen.o string/strrchr.o \ +STRING_OBJECTS = string/ctype.o string/memccpy.o string/memchr.o \ + string/memcmp.o string/memcpy.o string/memicmp.o\ + string/memmove.o string/memset.o string/strcat.o \ + string/strchr.o string/strcmp.o string/strcspn.o \ + string/strcpy.o string/stricmp.o string/strlen.o \ + string/strlwr.o string/strncat.o string/strncmp.o \ + string/strncpy.o string/strnicmp.o string/strnlen.o \ + string/strpbrk.o string/strrchr.o string/strspn.o \ string/strstr.o string/strupr.o string/wstring.o OBJECTS = napi.o ldr/startup.o $(RTL_OBJECTS) \ diff --git a/reactos/lib/ntdll/rtl/unicode.c b/reactos/lib/ntdll/rtl/unicode.c index fda52201f62..b649d2447c4 100644 --- a/reactos/lib/ntdll/rtl/unicode.c +++ b/reactos/lib/ntdll/rtl/unicode.c @@ -404,6 +404,13 @@ NTSTATUS RtlIntegerToUnicodeString(IN ULONG Value, IN ULONG Base, return STATUS_SUCCESS; } + +ULONG RtlUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString) +{ + return UnicodeString->Length/2; +} + + NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString, IN PUNICODE_STRING SourceString, IN BOOLEAN AllocateDestinationString) @@ -430,7 +437,8 @@ NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString, SourceString->Buffer-=SourceString->Length; return STATUS_SUCCESS; -}; +} + NTSTATUS RtlUnicodeStringToInteger(IN PUNICODE_STRING String, IN ULONG Base, OUT PULONG Value) diff --git a/reactos/lib/ntdll/stdio/vsprintf.c b/reactos/lib/ntdll/stdio/vsprintf.c index 971d8b06cad..e2d7aca59cf 100644 --- a/reactos/lib/ntdll/stdio/vsprintf.c +++ b/reactos/lib/ntdll/stdio/vsprintf.c @@ -383,19 +383,12 @@ int wsprintfW(unsigned short * buf, const unsigned short *fmt, ...) } #endif -unsigned short towupper(unsigned short w) -{ - if ( w < L'A' ) - return w + 'A'; - else - return w; -} - +#if 0 int iswlower(wint_t w) { if ( w < L'A' ) return 1; else - return 0; + return 0; } - +#endif diff --git a/reactos/lib/ntdll/string/ctype.c b/reactos/lib/ntdll/string/ctype.c index 24565d1d761..d6eeacd2e9e 100644 --- a/reactos/lib/ntdll/string/ctype.c +++ b/reactos/lib/ntdll/string/ctype.c @@ -1,73 +1,101 @@ +#include + #define upalpha ('A' - 'a') -int isalpha(char c) +int isalpha(int c) { return(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))); } -int isalnum(char c) +int isalnum(int c) { return(isalpha(c)||isdigit(c)); } -int iscntrl(char c) +int iscntrl(int c) { return((c >=0x00 && c <= 0x1f) || c == 0x7f); } -int isdigit(char c) +int isdigit(int c) { return((c>='0') && (c<='9')); } -int isgraph(char c) +int isgraph(int c) { return(c>=0x21 && c<=0x7e); } -int islower(char c) +int islower(int c) { return((c>='a') && (c<='z')); } -int isprint(char c) +int isprint(int c) { return(c>=0x20 && c<=0x7e); } -int ispunct(char c) +int ispunct(int c) { return((c>=0x21 && c<=0x2f)||(c>=0x3a && c<=0x40)||(c>=0x5b && c<=0x60)); } -int isspace(char c) +int isspace(int c) { return(c==' '||c=='\t'); } -int isupper(char c) +int isupper(int c) { return((c>='A') && (c<='Z')); } -int isxdigit(char c) +int isxdigit(int c) { return(((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z'))); } - -char tolower(char c) +int _tolower(int c) { if (c>='A' && c <= 'Z') return (c - upalpha); return(c); } -char toupper(char c) +int _toupper(int c) { if ((c>='a') && (c<='z')) return (c+upalpha); return(c); } +int tolower(int c) +{ + if (c>='A' && c <= 'Z') + return (c - upalpha); + return(c); +} + +int toupper(int c) +{ + if ((c>='a') && (c<='z')) + return (c+upalpha); + return(c); +} + +wchar_t towlower(wchar_t c) +{ + if (c>='A' && c <= 'Z') + return (c - upalpha); + return(c); +} + +wchar_t towupper(wchar_t c) +{ + if ((c>='a') && (c<='z')) + return (c+upalpha); + return(c); +} diff --git a/reactos/lib/ntdll/string/memccpy.c b/reactos/lib/ntdll/string/memccpy.c new file mode 100644 index 00000000000..fae61949143 --- /dev/null +++ b/reactos/lib/ntdll/string/memccpy.c @@ -0,0 +1,9 @@ +#include + + +void * +_memccpy (void *to, const void *from,int c,size_t count) +{ + memcpy(to,from,count); + return memchr(to,c,count); +} \ No newline at end of file diff --git a/reactos/lib/ntdll/string/memchr.c b/reactos/lib/ntdll/string/memchr.c new file mode 100644 index 00000000000..cb0589fe24b --- /dev/null +++ b/reactos/lib/ntdll/string/memchr.c @@ -0,0 +1,18 @@ +/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ + + +#include + +void * +memchr(const void *s, int c, size_t n) +{ + if (n) + { + const char *p = s; + do { + if (*p++ == c) + return (void *)(p-1); + } while (--n != 0); + } + return 0; +} diff --git a/reactos/lib/ntdll/string/memcmp.c b/reactos/lib/ntdll/string/memcmp.c new file mode 100644 index 00000000000..1c361a33074 --- /dev/null +++ b/reactos/lib/ntdll/string/memcmp.c @@ -0,0 +1,17 @@ +/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include + +int +memcmp(const void *s1, const void *s2, size_t n) +{ + if (n != 0) + { + const unsigned char *p1 = s1, *p2 = s2; + + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return 0; +} diff --git a/reactos/lib/ntdll/string/memicmp.c b/reactos/lib/ntdll/string/memicmp.c new file mode 100644 index 00000000000..001c1cd93b5 --- /dev/null +++ b/reactos/lib/ntdll/string/memicmp.c @@ -0,0 +1,20 @@ +/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include +#include + +int +_memicmp(const void *s1, const void *s2, size_t n) +{ + if (n != 0) + { + const unsigned char *p1 = s1, *p2 = s2; + + do { + if (toupper(*p1) != toupper(*p2)) + return (*p1 - *p2); + p1++; + p2++; + } while (--n != 0); + } + return 0; +} diff --git a/reactos/lib/ntdll/string/strpbrk.c b/reactos/lib/ntdll/string/strpbrk.c new file mode 100644 index 00000000000..5f642c4c1bf --- /dev/null +++ b/reactos/lib/ntdll/string/strpbrk.c @@ -0,0 +1,18 @@ +/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include + + +char * +strpbrk(const char *s1, const char *s2) +{ + const char *scanp; + int c, sc; + + while ((c = *s1++) != 0) + { + for (scanp = s2; (sc = *scanp++) != 0;) + if (sc == c) + return (char *)(s1 - 1); + } + return 0; +} diff --git a/reactos/lib/ntdll/string/strspn.c b/reactos/lib/ntdll/string/strspn.c new file mode 100644 index 00000000000..1532db001db --- /dev/null +++ b/reactos/lib/ntdll/string/strspn.c @@ -0,0 +1,16 @@ +/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include + +size_t +strspn(const char *s1, const char *s2) +{ + const char *p = s1, *spanp; + char c, sc; + + cont: + c = *p++; + for (spanp = s2; (sc = *spanp++) != 0;) + if (sc == c) + goto cont; + return (p - 1 - s1); +} diff --git a/reactos/lib/ntdll/string/wstring.c b/reactos/lib/ntdll/string/wstring.c index 943ee8677ba..4b6bdd6d70e 100644 --- a/reactos/lib/ntdll/string/wstring.c +++ b/reactos/lib/ntdll/string/wstring.c @@ -20,14 +20,56 @@ /* FUNCTIONS *****************************************************************/ -int wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t size) +int _wcsicmp(const wchar_t* cs,const wchar_t * ct) { + while (towlower(*cs) == towlower(*ct)) + { + if (*cs == 0) + return 0; + cs++; + ct++; + } + return towlower(*cs) - towlower(*ct); } -int wcsicmp(const wchar_t* ws1, const wchar_t* ws2) + +wchar_t* _wcslwr(wchar_t *x) { + wchar_t *y=x; + + while (*y) { + *y=towlower(*y); + y++; + } + return x; } +int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count) +{ + wchar_t *save = (wchar_t *)cs; + while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count) + { + if (*cs == 0) + return 0; + cs++; + ct++; + } + return towlower(*cs) - towlower(*ct); +} + + +wchar_t *_wcsupr(wchar_t *x) +{ + wchar_t *y=x; + + while (*y) { + *y=towupper(*y); + y++; + } + return x; +} + + wchar_t* wcscat(wchar_t *dest, const wchar_t *src) { int i, j; @@ -81,6 +123,26 @@ wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2) } +size_t wcscspn(const wchar_t *str,const wchar_t *reject) +{ + wchar_t *s; + wchar_t *t; + s=(wchar_t *)str; + do { + t=(wchar_t *)reject; + while (*t) { + if (*t==*s) + break; + t++; + } + if (*t) + break; + s++; + } while (*s); + return s-str; /* nr of wchars */ +} + + size_t wcslen(const wchar_t *s) { unsigned int len = 0; @@ -114,6 +176,19 @@ wcsncat(wchar_t *dest, const wchar_t *src, size_t count) } +int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count) +{ + while ((*cs) == (*ct) && count > 0) + { + if (*cs == 0) + return 0; + cs++; + ct++; + count--; + } + return (*cs) - (*ct); +} + wchar_t* wcsncpy(wchar_t *dest, const wchar_t *src, size_t count) { @@ -133,8 +208,24 @@ wchar_t* wcsncpy(wchar_t *dest, const wchar_t *src, size_t count) } -wchar_t * -wcsrchr(const wchar_t *str, wchar_t ch) +wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2) +{ + const wchar_t *scanp; + int c, sc; + + while ((c = *s1++) != 0) + { + for (scanp = s2; (sc = *scanp++) != 0;) + if (sc == c) + { + return (wchar_t *)(--s1); + } + } + return 0; +} + + +wchar_t * wcsrchr(const wchar_t *str, wchar_t ch) { unsigned int len = 0; while (str[len] != ((wchar_t)0)) @@ -154,4 +245,44 @@ wcsrchr(const wchar_t *str, wchar_t ch) } +size_t wcsspn(const wchar_t *str,const wchar_t *accept) +{ + wchar_t *s; + wchar_t *t; + s=(wchar_t *)str; + do { + t=(wchar_t *)accept; + while (*t) { + if (*t==*s) + break; + t++; + } + if (!*t) + break; + s++; + } while (*s); + return s-str; /* nr of wchars */ +} + +wchar_t *wcsstr(const wchar_t *s,const wchar_t *b) +{ + wchar_t *x; + wchar_t *y; + wchar_t *c; + x=(wchar_t *)s; + while (*x) { + if (*x==*b) { + y=x; + c=(wchar_t *)b; + while (*y && *c && *y==*c) { + c++; + y++; + } + if (!*c) + return x; + } + x++; + } + return NULL; +} diff --git a/reactos/lib/ntdll/stubs/stubs.c b/reactos/lib/ntdll/stubs/stubs.c index 536f2935d74..61c5f97e98b 100644 --- a/reactos/lib/ntdll/stubs/stubs.c +++ b/reactos/lib/ntdll/stubs/stubs.c @@ -213,20 +213,11 @@ STUB(_itoa) STUB(_itow) STUB(_ltoa) STUB(_ltow) -STUB(_memccpy) -STUB(_memicmp) STUB(_snprintf) STUB(_snwprintf) -//STUB(_strlwr) -STUB(_tolower) -STUB(_toupper) STUB(_ultoa) STUB(_ultow) STUB(_vsnprintf) -STUB(_wcsicmp) -STUB(_wcslwr) -STUB(_wcsnicmp) -STUB(_wcsupr) STUB(_wtoi) STUB(_wtoi64) STUB(_wtol) @@ -241,15 +232,11 @@ STUB(iswctype) STUB(labs) STUB(log) STUB(mbstowcs) -STUB(memchr) -STUB(memcmp) STUB(pow) STUB(qsort) STUB(sin) STUB(sqrt) STUB(sscanf) -STUB(strpbrk) -STUB(strspn) STUB(swprintf) STUB(tan) diff --git a/reactos/ntoskrnl/makefile_rex b/reactos/ntoskrnl/makefile_rex index dff7cb7971e..1f70270bb27 100644 --- a/reactos/ntoskrnl/makefile_rex +++ b/reactos/ntoskrnl/makefile_rex @@ -1,4 +1,4 @@ -# $Id: makefile_rex,v 1.28 1999/07/17 23:10:25 ea Exp $ +# $Id: makefile_rex,v 1.29 1999/07/29 21:25:04 ekohl Exp $ # # ReactOS Operating System # @@ -15,11 +15,11 @@ NT_OBJECTS = nt/port.o nt/channel.o nt/ntevent.o nt/nttimer.o nt/atom.o \ nt/evtpair.o nt/ntsem.o nt/mutant.o nt/misc.o nt/plugplay.o \ nt/profile.o nt/nt.o nt/zw.o -RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \ - rtl/time.o rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \ - rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \ +RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/time.o \ + rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \ + rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \ rtl/wstring.o rtl/memcpy.o rtl/memmove.o rtl/memset.o \ - rtl/memchr.o + rtl/memchr.o rtl/string.o rtl/stdlib.o KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \ ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 5919efea90c..3331bebe4c9 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.13 1999/07/17 23:10:26 ea Exp $ +; $Id: ntoskrnl.def,v 1.14 1999/07/29 21:25:04 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -87,6 +87,7 @@ KeInitializeEvent KeInitializeSpinLock KeInsertQueueDpc KeLowerIrql +KeQuerySystemTime KeStallExecutionProcessor KeSynchronizeExecution KeRaiseIrql @@ -265,24 +266,83 @@ ZwWaitForMultipleObjects@20 ZwWaitForSingleObject@12 ZwWriteFile@36 ZwYieldExecution@0 +;_abnormal_termination +;_alldiv +;_allmul +;_allrem +;_allshl +;_allshr +;_aulldiv +;_aullrem +;_aullshr +;_except_handler2 +;_global_unwind2 +;_itoa +;_local_unwind2 +;_purecall +;_snprintf +;_snwprintf +_stricmp +_strlwr +_strnicmp +_strnset +_strrev +_strset +_strupr +;_vsnprintf +_wcsicmp +_wcslwr +_wcsnicmp +_wcsnset +_wcsrev +_wcsupr +;atoi +;atol isdigit islower isprint isspace isupper isxdigit +;mbstowcs +;mbtowc memchr memcpy memmove memset -strtok +;qsort +rand +sprintf +srand +strcat +strchr +strcmp +strcpy +strlen +strncat +strncmp +strcpy +strrchr +strspn +strstr +;strtok +;swprintf tolower toupper towlower towupper vsprintf +wcscat wcschr +wcscmp wcscpy +wcscspn wcslen -wcsncpy wcsncat +wcsncmp +wcsncpy +wcsrchr +wcsspn +wcsstr +;wcstombs +;wctomb diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index 904222b2f44..e81e2ac74e5 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.1 1999/07/17 23:10:26 ea Exp $ +; $Id: ntoskrnl.edf,v 1.2 1999/07/29 21:25:04 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -87,6 +87,7 @@ KeInitializeEvent KeInitializeSpinLock KeInsertQueueDpc KeLowerIrql +KeQuerySystemTime KeStallExecutionProcessor KeSynchronizeExecution KeRaiseIrql @@ -265,24 +266,83 @@ ZwWaitForMultipleObjects=ZwWaitForMultipleObjects@20 ZwWaitForSingleObject=ZwWaitForSingleObject@12 ZwWriteFile=ZwWriteFile@36 ZwYieldExecution=ZwYieldExecution@0 +;_abnormal_termination +;_alldiv +;_allmul +;_allrem +;_allshl +;_allshr +;_aulldiv +;_aullrem +;_aullshr +;_except_handler2 +;_global_unwind2 +;_itoa +;_local_unwind2 +;_purecall +;_snprintf +;_snwprintf +_stricmp +_strlwr +_strnicmp +_strnset +_strrev +_strset +_strupr +;_vsnprintf +_wcsicmp +_wcslwr +_wcsnicmp +_wcsnset +_wcsrev +_wcsupr +;atoi +;atol isdigit islower isprint isspace isupper isxdigit +;mbstowcs +;mbtowc memchr memcpy memmove memset -strtok +;qsort +rand +sprintf +srand +strcat +strchr +strcmp +strcpy +strlen +strncat +strncmp +strcpy +strrchr +strspn +strstr +;strtok +;swprintf tolower toupper towlower towupper vsprintf +wcscat wcschr +wcscmp wcscpy +wcscspn wcslen -wcsncpy wcsncat +wcsncmp +wcsncpy +wcsrchr +wcsspn +wcsstr +;wcstombs +;wctomb diff --git a/reactos/ntoskrnl/ob/namespc.c b/reactos/ntoskrnl/ob/namespc.c index 5878192dfa7..12d873c1afd 100644 --- a/reactos/ntoskrnl/ob/namespc.c +++ b/reactos/ntoskrnl/ob/namespc.c @@ -72,10 +72,10 @@ VOID ObAddEntryDirectory(PDIRECTORY_OBJECT Parent, { KIRQL oldlvl; POBJECT_HEADER Header = BODY_TO_HEADER(Object); - + RtlInitUnicodeString(&Header->Name, wcsdup(Name)); Header->Parent = Parent; - + KeAcquireSpinLock(&Parent->Lock, &oldlvl); InsertTailList(&Parent->head, &Header->Entry); KeReleaseSpinLock(&Parent->Lock, oldlvl); @@ -108,7 +108,7 @@ PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject, DPRINT("Scanning %w %w\n",current_obj->Name.Buffer, Name); if (Attributes & OBJ_CASE_INSENSITIVE) { - if (wcsicmp(current_obj->Name.Buffer, Name)==0) + if (_wcsicmp(current_obj->Name.Buffer, Name)==0) { DPRINT("Found it %x\n",HEADER_TO_BODY(current_obj)); return(HEADER_TO_BODY(current_obj)); diff --git a/reactos/ntoskrnl/rtl/stdlib.c b/reactos/ntoskrnl/rtl/stdlib.c new file mode 100644 index 00000000000..177222cc4af --- /dev/null +++ b/reactos/ntoskrnl/rtl/stdlib.c @@ -0,0 +1,86 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/rtl/stdlib.c + * PURPOSE: Standard library functions + * PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de) + * UPDATE HISTORY: + * 1999/07/29 ekohl Created + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +/* GLOBALS ****************************************************************/ + +static unsigned long long next = 0; + +/* FUNCTIONS ****************************************************************/ + +#if 0 +int atoi(const char *str) +{ + return (int)strtol(str, 0, 10); +} + +long atol(const char *str) +{ + return strtol(str, 0, 10); +} + +char *_itoa(int value, char *string, int radix) +{ + char tmp[33]; + char *tp = tmp; + int i; + unsigned v; + int sign; + char *sp; + + if (string == 0) + return NULL; + + if (radix > 36 || radix <= 1) + { + __set_errno(EDOM); + return 0; + } + + sign = (radix == 10 && value < 0); + if (sign) + v = -value; + else + v = (unsigned)value; + while (v || tp == tmp) + { + i = v % radix; + v = v / radix; + if (i < 10) + *tp++ = i+'0'; + else + *tp++ = i + 'a' - 10; + } + + if (sign) + *sp++ = '-'; + while (tp > tmp) + *sp++ = *--tp; + *sp = 0; + return string; +} +#endif + + +int rand(void) +{ + next = next * 0x5deece66dLL + 11; + return (int)((next >> 16) & RAND_MAX); +} + + +void srand(unsigned seed) +{ + next = seed; +} diff --git a/reactos/ntoskrnl/rtl/string.c b/reactos/ntoskrnl/rtl/string.c new file mode 100644 index 00000000000..d595991ae61 --- /dev/null +++ b/reactos/ntoskrnl/rtl/string.c @@ -0,0 +1,304 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/rtl/string.c + * PURPOSE: Ascii string functions + * PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de) + * UPDATE HISTORY: + * 1999/07/29 ekohl Created + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +/* FUNCTIONS *****************************************************************/ + +int _stricmp(const char *s1, const char *s2) +{ + while (toupper(*s1) == toupper(*s2)) + { + if (*s1 == 0) + return 0; + s1++; + s2++; + } + return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2)); +} + + +char * _strlwr(char *x) +{ + char *y=x; + + while (*y) + { + *y=tolower(*y); + y++; + } + return x; +} + + +int _strnicmp(const char *s1, const char *s2, size_t n) +{ + if (n == 0) + return 0; + do + { + if (toupper(*s1) != toupper(*s2++)) + return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)--s2); + if (*s1++ == 0) + break; + } + while (--n != 0); + return 0; +} + +char* _strnset(char* szToFill, int szFill, size_t sizeMaxFill) +{ + char *t = szToFill; + int i = 0; + while (*szToFill != 0 && i < sizeMaxFill) + { + *szToFill = szFill; + szToFill++; + i++; + + } + return t; +} + + +char * _strrev(char *s) +{ + char *e; + char a; + + e = s; + while (*e) + e++; + + while (s -/* GLOBALS *****************************************************************/ - -wchar_t * ___wcstok = NULL; - /* FUNCTIONS *****************************************************************/ -wchar_t* wcsdup(wchar_t* src) +int _wcsicmp (const wchar_t* cs, const wchar_t* ct) { - wchar_t* dest; - - dest = ExAllocatePool(NonPagedPool, (wcslen(src)+1)*2); - wcscpy(dest,src); - return(dest); + while (*cs != '\0' && *ct != '\0' && towupper(*cs) == towupper(*ct)) + { + cs++; + ct++; + } + return *cs - *ct; } +wchar_t * _wcslwr (wchar_t *x) +{ + wchar_t *y=x; + + while (*y) + { + *y=towlower(*y); + y++; + } + return x; +} + + +int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count) +{ + wchar_t *save = (wchar_t *)cs; + while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count) + { + if (*cs == 0) + return 0; + cs++; + ct++; + } + return towlower(*cs) - towlower(*ct); +} + + +wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill) +{ + wchar_t *t = wsToFill; + int i = 0; + while( *wsToFill != 0 && i < sizeMaxFill) + { + *wsToFill = wcFill; + wsToFill++; + i++; + } + return t; +} + + +wchar_t * _wcsrev(wchar_t *s) +{ + wchar_t *e; + wchar_t a; + e=s; + while (*e) + e++; + while (s