From 04a8eda9852c669f2bf34eaf19d439f5737471f7 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Tue, 17 Oct 2000 00:27:47 +0000 Subject: [PATCH] Implemented old Win 2.x string functions. --- dlls/kernel/kernel.spec | 8 +++---- dlls/kernel/kernel_main.c | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/dlls/kernel/kernel.spec b/dlls/kernel/kernel.spec index c39384abb0..3f57447db4 100644 --- a/dlls/kernel/kernel.spec +++ b/dlls/kernel/kernel.spec @@ -83,10 +83,10 @@ owner kernel32 75 stub OpenPathName 76 stub DeletePathName # Reserved*: old Win 2.x functions now moved to USER (Win 3.0+) -77 stub Reserved1 #AnsiNext16 -78 stub Reserved2 #AnsiPrev16 -79 stub Reserved3 #AnsiUpper16 -80 stub Reserved4 #AnsiLower16 +77 pascal Reserved1(segptr) KERNEL_AnsiNext16 +78 pascal Reserved2(segptr segptr) KERNEL_AnsiPrev16 +79 pascal Reserved3(segstr) KERNEL_AnsiUpper16 +80 pascal Reserved4(segstr) KERNEL_AnsiLower16 81 pascal16 _lclose(word) _lclose16 82 pascal16 _lread(word segptr word) WIN16_lread 83 pascal16 _lcreat(str word) _lcreat16 diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index caa214f985..09d3aafb9b 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c @@ -3,6 +3,7 @@ */ #include +#include #include "winbase.h" #include "wine/winbase16.h" @@ -111,3 +112,50 @@ BOOL WINAPI MAIN_KernelInit( HINSTANCE hinst, DWORD reason, LPVOID reserved ) * Entry point for kernel functions that do nothing. */ LONG WINAPI KERNEL_nop(void) { return 0; } + + +/*************************************************************************** + * + * Win 2.x string functions now moved to USER + * + * We rather want to implement them here instead of doing Callouts + */ +SEGPTR WINAPI KERNEL_AnsiNext16(SEGPTR current) +{ + return (*(char *)PTR_SEG_TO_LIN(current)) ? current + 1 : current; +} + +SEGPTR WINAPI KERNEL_AnsiPrev16( SEGPTR start, SEGPTR current ) +{ + return (current==start)?start:current-1; +} + +SEGPTR WINAPI KERNEL_AnsiUpper16( SEGPTR strOrChar ) +{ + /* uppercase only one char if strOrChar < 0x10000 */ + if (HIWORD(strOrChar)) + { + char *s = PTR_SEG_TO_LIN(strOrChar); + while (*s) { + *s = toupper(*s); + s++; + } + return strOrChar; + } + else return toupper((char)strOrChar); +} + +SEGPTR WINAPI KERNEL_AnsiLower16( SEGPTR strOrChar ) +{ + /* lowercase only one char if strOrChar < 0x10000 */ + if (HIWORD(strOrChar)) + { + char *s = PTR_SEG_TO_LIN(strOrChar); + while (*s) { + *s = tolower(*s); + s++; + } + return strOrChar; + } + else return tolower((char)strOrChar); +}