mirror of
https://github.com/reactos/reactos.git
synced 2025-04-18 03:34:11 +00:00
- apps/utils/tickcount/tickcount.c: corrected assertion
- include/funcs.h: declared GetScrollBarInfo - include/napi/teb.h: removed misleading comment about NtCurrentTeb; preparing TEB for Windows 2003-compatible FLS support - include/tchar.h: added _tcslen - include/tgetopt.h: type-generic getopt (see lib/tgetopt) - include/win32k/ntuser.h, subsys/win32k/ntuser/window.c, subsys/win32k/ntuser/timer.c, lib/user32/misc/timer.c, lib/user32/windows/paint.c: corrected declarations of NtUserSetTimer, NtUserKillTimer and NtUserRedrawWindow (Win32K doesn't follow the NT calling convention) - lib/crtdll/crtdll.def: exported ::operator new and ::operator delete - lib/kernel32/thread/fls.c: FLS support almost done - lib/ntdll/*: implemented _chkstk/_alloca_probe - some more Visual C++ programs should run now; exported NtCurrentTeb for compatibility with Windows NT 3.51 and some non-i386 architectures; removed the CRT from the linker libraries - lib/string/*: type-generic string functions (single, shared implementation for single-byte and Unicode variants using _t macros); corrected a bug in the i386 wcsncmp; merged strspn/strcspn; corrected non-portable code in strspn/strcspn; implemented strnlen/tcsnlen for the i386 architecture; all changes were regression-tested and compared against the Microsoft CRT - tools/helper.mk: libraries, dlls and drivers now depend from their DEF/EDF files svn path=/trunk/; revision=5010
This commit is contained in:
parent
8ed329a442
commit
5514f345a3
83 changed files with 1211 additions and 1125 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: tickcount.c,v 1.1 2003/02/09 21:17:21 hyperion Exp $
|
||||
/* $Id: tickcount.c,v 1.2 2003/07/06 23:04:18 hyperion Exp $
|
||||
*/
|
||||
/*
|
||||
tickcount -- Display the kernel tick count in human-readable format
|
||||
|
@ -71,7 +71,7 @@ void print_uptime
|
|||
uint64_t tick_cur = tickcount / ticks_per_slice[curslice];
|
||||
uint64_t tick_residual = tickcount % ticks_per_slice[curslice];
|
||||
|
||||
assert(tick_cur <= (~((unsigned)0)));
|
||||
assert(tick_cur <= (~((uint64_t)0)));
|
||||
|
||||
if(tick_residual == 0)
|
||||
{
|
||||
|
|
|
@ -4935,7 +4935,12 @@ EnableScrollBar(
|
|||
UINT wSBflags,
|
||||
UINT wArrows);
|
||||
|
||||
|
||||
BOOL STDCALL GetScrollBarInfo(
|
||||
HWND hwnd,
|
||||
LONG idObject,
|
||||
PSCROLLBARINFO psbi
|
||||
);
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetClientRect(
|
||||
|
|
|
@ -227,6 +227,8 @@ typedef struct _TEB
|
|||
ULONG Spare5; // F7Ch
|
||||
PVOID ReservedForOle; // F80h
|
||||
ULONG WaitingOnLoaderLock; // F84h
|
||||
ULONG Unknown[11]; // F88h
|
||||
PVOID FlsSlots; // FB4h
|
||||
PVOID WineDebugInfo; // Needed for WINE DLL's
|
||||
} TEB, *PTEB;
|
||||
|
||||
|
@ -236,10 +238,6 @@ typedef struct _TEB
|
|||
|
||||
#if defined(_M_IX86)
|
||||
/* on the x86, the TEB is contained in the FS segment */
|
||||
/*
|
||||
FIXME: GCC should allow defining a variable that directly maps to a register.
|
||||
It could make for even faster code
|
||||
*/
|
||||
static inline struct _TEB * NtCurrentTeb(void)
|
||||
{
|
||||
struct _TEB * pTeb;
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
* $Author: hyperion $
|
||||
* $Date: 2003/04/22 03:20:25 $
|
||||
* $Date: 2003/07/06 23:04:18 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -114,6 +114,7 @@ typedef wchar_t TCHAR;
|
|||
#define _tcsncat wcsncat
|
||||
#define _tcsncmp wcsncmp
|
||||
#define _tcsncpy wcsncpy
|
||||
#define _tcsnlen wcsnlen
|
||||
#define _tcspbrk wcspbrk
|
||||
#define _tcsrchr wcsrchr
|
||||
#define _tcsspn wcsspn
|
||||
|
@ -218,6 +219,7 @@ typedef char TCHAR;
|
|||
#define _tcsncat strncat
|
||||
#define _tcsncmp strncmp
|
||||
#define _tcsncpy strncpy
|
||||
#define _tcsnlen strnlen
|
||||
#define _tcspbrk strpbrk
|
||||
#define _tcsrchr strrchr
|
||||
#define _tcsspn strspn
|
||||
|
|
90
reactos/include/tgetopt.h
Normal file
90
reactos/include/tgetopt.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define _toption _woption
|
||||
#define _toptarg _woptarg
|
||||
#define _toptind _woptind
|
||||
#define _topterr _wopterr
|
||||
#define _toptopt _woptopt
|
||||
#define _tgetopt _wgetopt
|
||||
#define _tgetopt_long _wgetopt_long
|
||||
#define _tgetopt_long_only _wgetopt_long_only
|
||||
#define _tgetopt_internal _wgetopt_internal
|
||||
#else
|
||||
#define _toption option
|
||||
#define _toptarg optarg
|
||||
#define _toptind optind
|
||||
#define _topterr opterr
|
||||
#define _toptopt optopt
|
||||
#define _tgetopt getopt
|
||||
#define _tgetopt_long getopt_long
|
||||
#define _tgetopt_long_only getopt_long_only
|
||||
#define _tgetopt_internal _getopt_internal
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int opterr;
|
||||
extern int optopt;
|
||||
|
||||
extern wchar_t *_woptarg;
|
||||
extern int _woptind;
|
||||
extern int _wopterr;
|
||||
extern int _woptopt;
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
struct _woption
|
||||
{
|
||||
const wchar_t *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
const char *shortopts, const struct option *longopts, int *longind);
|
||||
|
||||
extern int _wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts);
|
||||
extern int _wgetopt_long (int argc, wchar_t *const *argv, const wchar_t *shortopts,
|
||||
const struct _woption *longopts, int *longind);
|
||||
extern int _wgetopt_long_only (int argc, wchar_t *const *argv,
|
||||
const wchar_t *shortopts,
|
||||
const struct _woption *longopts, int *longind);
|
||||
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts, const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
|
||||
extern int _wgetopt_internal (int argc, wchar_t *const *argv,
|
||||
const wchar_t *shortopts,
|
||||
const struct _woption *longopts, int *longind,
|
||||
int long_only);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_H */
|
||||
|
|
@ -906,11 +906,13 @@ STDCALL
|
|||
NtUserIsClipboardFormatAvailable(
|
||||
DWORD Unknown0);
|
||||
|
||||
NTSTATUS
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserKillTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR IDEvent);
|
||||
NtUserKillTimer
|
||||
(
|
||||
HWND hWnd,
|
||||
UINT_PTR uIDEvent
|
||||
);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
@ -1095,9 +1097,15 @@ NtUserRealChildWindowFromPoint(
|
|||
DWORD Unknown1,
|
||||
DWORD Unknown2);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserRedrawWindow
|
||||
(
|
||||
HWND hWnd,
|
||||
CONST RECT *lprcUpdate,
|
||||
HRGN hrgnUpdate,
|
||||
UINT flags
|
||||
);
|
||||
|
||||
RTL_ATOM
|
||||
STDCALL
|
||||
|
@ -1422,13 +1430,15 @@ NtUserSetThreadState(
|
|||
DWORD Unknown0,
|
||||
DWORD Unknown1);
|
||||
|
||||
NTSTATUS
|
||||
UINT_PTR
|
||||
STDCALL
|
||||
NtUserSetTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR * IDEvent,
|
||||
UINT Period,
|
||||
TIMERPROC TimerFunc);
|
||||
NtUserSetTimer
|
||||
(
|
||||
HWND hWnd,
|
||||
UINT_PTR nIDEvent,
|
||||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc
|
||||
);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
; DISCLAMED. This includes but is not limited to warrenties of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
;
|
||||
; $Revision: 1.15 $
|
||||
; $Author: gvg $
|
||||
; $Date: 2003/04/24 22:21:13 $
|
||||
; $Revision: 1.16 $
|
||||
; $Author: hyperion $
|
||||
; $Date: 2003/07/06 23:04:19 $
|
||||
;
|
||||
; These three functions appear to be name mangled in some way, so GCC is
|
||||
; probably not going to be able to use them in any case.
|
||||
|
@ -41,6 +41,8 @@ LIBRARY CRTDLL.DLL
|
|||
EXPORTS
|
||||
__builtin_new
|
||||
__builtin_delete
|
||||
??2@YAPAXI@Z=malloc
|
||||
??3@YAXPAX@Z=free
|
||||
_set_new_handler__FPFUi_i
|
||||
_CIacos
|
||||
_CIasin
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fls.c,v 1.1 2003/05/29 00:36:41 hyperion Exp $
|
||||
/* $Id: fls.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -35,20 +35,68 @@ BOOL WINAPI FlsFree(DWORD dwFlsIndex)
|
|||
|
||||
PVOID WINAPI FlsGetValue(DWORD dwFlsIndex)
|
||||
{
|
||||
(void)dwFlsIndex;
|
||||
PVOID * ppFlsSlots;
|
||||
PVOID pRetVal;
|
||||
|
||||
if(dwFlsIndex >= 128) goto l_InvalidParam;
|
||||
|
||||
UNIMPLEMENTED;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
ppFlsSlots = NtCurrentTeb()->FlsSlots;
|
||||
|
||||
if(ppFlsSlots == NULL) goto l_InvalidParam;
|
||||
|
||||
SetLastError(0);
|
||||
pRetVal = ppFlsSlots[dwFlsIndex + 2];
|
||||
|
||||
return pRetVal;
|
||||
|
||||
l_InvalidParam:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
|
||||
{
|
||||
(void)dwFlsIndex;
|
||||
(void)lpFlsData;
|
||||
PVOID * ppFlsSlots;
|
||||
TEB * pTeb = NtCurrentTeb();
|
||||
|
||||
UNIMPLEMENTED;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
if(dwFlsIndex >= 128) goto l_InvalidParam;
|
||||
|
||||
ppFlsSlots = pTeb->FlsSlots;
|
||||
|
||||
if(ppFlsSlots == NULL)
|
||||
{
|
||||
PEB * pPeb = pTeb->Peb;
|
||||
|
||||
ppFlsSlots = RtlAllocateHeap
|
||||
(
|
||||
pPeb->ProcessHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
(128 + 2) * sizeof(PVOID)
|
||||
);
|
||||
|
||||
if(ppFlsSlots == NULL) goto l_OutOfMemory;
|
||||
|
||||
pTeb->FlsSlots = ppFlsSlots;
|
||||
|
||||
RtlAcquirePebLock();
|
||||
|
||||
/* TODO: initialization */
|
||||
|
||||
RtlReleasePebLock();
|
||||
}
|
||||
|
||||
ppFlsSlots[dwFlsIndex + 2] = lpFlsData;
|
||||
|
||||
return TRUE;
|
||||
|
||||
l_OutOfMemory:
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto l_Fail;
|
||||
|
||||
l_InvalidParam:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
||||
l_Fail:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.def,v 1.103 2003/06/11 15:38:36 ekohl Exp $
|
||||
; $Id: ntdll.def,v 1.104 2003/07/06 23:04:19 hyperion Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -950,4 +950,5 @@ InterlockedIncrement@4
|
|||
InterlockedDecrement@4
|
||||
InterlockedExchange@8
|
||||
InterlockedCompareExchange@12
|
||||
_NtCurrentTeb@0
|
||||
;EOF
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.edf,v 1.92 2003/06/11 15:38:36 ekohl Exp $
|
||||
; $Id: ntdll.edf,v 1.93 2003/07/06 23:04:19 hyperion Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -830,7 +830,7 @@ __iscsymf
|
|||
__toascii
|
||||
_alldiv
|
||||
_allmul
|
||||
_alloca_probe = _chkstk
|
||||
_alloca_probe
|
||||
_allrem
|
||||
_allshl
|
||||
_allshr
|
||||
|
@ -943,6 +943,7 @@ wcsstr
|
|||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
NtCurrentTeb=_NtCurrentTeb@0
|
||||
;wine_dbgstr_an
|
||||
;wine_dbgstr_wn
|
||||
;wine_dbgstr_guid
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.87 2003/06/11 15:42:31 ekohl Exp $
|
||||
# $Id: makefile,v 1.88 2003/07/06 23:04:19 hyperion Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -14,7 +14,7 @@ TARGET_ASFLAGS = -I $(PATH_TO_TOP)/include
|
|||
|
||||
TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \
|
||||
-Wl,--section-alignment,0x1000 \
|
||||
-nostartfiles
|
||||
-nostartfiles -nostdlib
|
||||
|
||||
TARGET_SDKLIBS = string.a rosrtl.a
|
||||
|
||||
|
@ -59,7 +59,7 @@ RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \
|
|||
rtl/registry.o rtl/exception.o rtl/intrlck.o rtl/resource.o \
|
||||
rtl/handle.o rtl/atom.o rtl/message.o rtl/timezone.o \
|
||||
rtl/propvar.o rtl/security.o rtl/dos8dot3.o rtl/compress.o \
|
||||
rtl/encode.o rtl/random.o
|
||||
rtl/encode.o rtl/random.o rtl/teb.o
|
||||
|
||||
STDIO_OBJECTS = stdio/sprintf.o stdio/swprintf.o
|
||||
|
||||
|
|
|
@ -1,16 +1,66 @@
|
|||
/* $Id: chkstk.s,v 1.1 2003/06/11 15:37:15 ekohl Exp $
|
||||
/* $Id: chkstk.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Stack checker
|
||||
* FILE: lib/ntdll/rtl/i386/chkstk.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
* PROGRAMER: KJK::Hyperion <noog@libero.it>
|
||||
*/
|
||||
|
||||
.globl __chkstk
|
||||
.globl __alloca_probe
|
||||
|
||||
/*
|
||||
_chkstk() is called by all stack allocations of more than 4 KB. It grows the
|
||||
stack in areas of 4 KB each, trying to access each area. This ensures that the
|
||||
guard page for the stack is hit, and the stack growing triggered
|
||||
*/
|
||||
.globl __chkstk
|
||||
__chkstk:
|
||||
ret
|
||||
__alloca_probe:
|
||||
|
||||
/* EAX = size to be allocated */
|
||||
/* save the ECX register */
|
||||
pushl %ecx
|
||||
|
||||
/* ECX = top of the previous stack frame */
|
||||
leal 8(%esp), %ecx
|
||||
|
||||
/* probe the desired memory, page by page */
|
||||
cmpl $0x1000, %eax
|
||||
jge .l_MoreThanAPage
|
||||
jmp .l_LessThanAPage
|
||||
|
||||
.l_MoreThanAPage:
|
||||
|
||||
/* raise the top of the stack by a page and probe */
|
||||
subl $0x1000, %ecx
|
||||
testl %eax, 0(%ecx)
|
||||
|
||||
/* loop if still more than a page must be probed */
|
||||
subl $0x1000, %eax
|
||||
cmpl $0x1000, %eax
|
||||
jge .l_MoreThanAPage
|
||||
|
||||
.l_LessThanAPage:
|
||||
|
||||
/* raise the top of the stack by EAX bytes (size % 4096) and probe */
|
||||
subl %eax, %ecx
|
||||
testl %eax, 0(%ecx)
|
||||
|
||||
/* EAX = top of the stack */
|
||||
movl %esp, %eax
|
||||
|
||||
/* allocate the memory */
|
||||
movl %ecx, %esp
|
||||
|
||||
/* restore ECX */
|
||||
movl 0(%eax), %ecx
|
||||
|
||||
/* restore the return address */
|
||||
movl 4(%eax), %eax
|
||||
pushl %eax
|
||||
|
||||
/* return */
|
||||
ret
|
||||
|
||||
/* EOF */
|
||||
|
|
14
reactos/lib/ntdll/rtl/teb.c
Normal file
14
reactos/lib/ntdll/rtl/teb.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* $Id: teb.c,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/csr/teb.c
|
||||
* PURPOSE:
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <napi/teb.h>
|
||||
|
||||
PTEB STDCALL _NtCurrentTeb() { return NtCurrentTeb(); }
|
||||
|
||||
/* EOF */
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile.i386,v 1.2 2003/06/04 18:14:46 hbirr Exp $
|
||||
# $Id: Makefile.i386,v 1.3 2003/07/06 23:04:19 hyperion Exp $
|
||||
|
||||
|
||||
EXCLUDE_FILTER = \
|
||||
|
@ -15,6 +15,7 @@ EXCLUDE_FILTER = \
|
|||
strncmp.o \
|
||||
strncpy.o \
|
||||
strrchr.o \
|
||||
strnlen.o \
|
||||
wcscat.o \
|
||||
wcschr.o \
|
||||
wcscmp.o \
|
||||
|
@ -23,6 +24,7 @@ EXCLUDE_FILTER = \
|
|||
wcsncat.o \
|
||||
wcsncmp.o \
|
||||
wcsncpy.o \
|
||||
wcsnlen.o \
|
||||
wcsrchr.o
|
||||
|
||||
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/*
|
||||
* $Id: strcat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strcat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char *strcat (char *s, const char *append)
|
||||
*/
|
||||
|
||||
.globl _strcat
|
||||
|
||||
_strcat:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
cld
|
||||
repne scasb
|
||||
dec %edi
|
||||
.L1:
|
||||
lodsb
|
||||
stosb
|
||||
test %al,%al
|
||||
jne .L1
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcscat.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,32 +1,6 @@
|
|||
/*
|
||||
* $Id: strchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char* strchr (const char* s, int c)
|
||||
*/
|
||||
|
||||
.globl _strchr
|
||||
|
||||
_strchr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%eax
|
||||
mov %al,%ah
|
||||
cld
|
||||
.L1:
|
||||
lodsb
|
||||
cmp %al,%ah
|
||||
je .L2
|
||||
test %al,%al
|
||||
jne .L1
|
||||
mov $1,%esi
|
||||
.L2:
|
||||
mov %esi,%eax
|
||||
dec %eax
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcschr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,36 +1,6 @@
|
|||
/*
|
||||
* $Id: strcmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strcmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* int *strcmp (const char* s1, const char* s2)
|
||||
*/
|
||||
|
||||
.globl _strcmp
|
||||
|
||||
_strcmp:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%edi
|
||||
xor %eax,%eax
|
||||
cld
|
||||
.L1:
|
||||
lodsb
|
||||
scasb
|
||||
jne .L2
|
||||
test %eax,%eax // bit 8..31 are set to 0
|
||||
jne .L1
|
||||
xor %eax,%eax
|
||||
jmp .L3
|
||||
.L2:
|
||||
sbb %eax,%eax
|
||||
or $1,%al
|
||||
.L3:
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcscmp.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,29 +1,6 @@
|
|||
/*
|
||||
* $Id: strcpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strcpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char *strcpy (char *to, const char *from)
|
||||
*/
|
||||
|
||||
.globl _strcpy
|
||||
|
||||
_strcpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
cld
|
||||
.L1:
|
||||
lodsb
|
||||
stosb
|
||||
test %al,%al
|
||||
jne .L1
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcscpy.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
/*
|
||||
* $Id: strlen.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strlen.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* size_t strlen (const char* s)
|
||||
*/
|
||||
|
||||
.globl _strlen
|
||||
|
||||
_strlen:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
cld
|
||||
repne scasb
|
||||
not %ecx
|
||||
dec %ecx
|
||||
mov %ecx,%eax
|
||||
pop %edi
|
||||
leave
|
||||
ret
|
||||
#include "tcslen.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,41 +1,6 @@
|
|||
/*
|
||||
* $Id: strncat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strncat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char *strncat (char *s, const char *append, size_t n)
|
||||
*/
|
||||
|
||||
.globl _strncat
|
||||
|
||||
_strncat:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
cld
|
||||
repne scasb
|
||||
dec %edi
|
||||
mov 0x10(%ebp),%ecx
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsb
|
||||
stosb
|
||||
test %al,%al
|
||||
jne .L1
|
||||
jmp .L3
|
||||
.L2:
|
||||
xor %eax,%eax
|
||||
stosb
|
||||
.L3:
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcsncat.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,40 +1,6 @@
|
|||
/*
|
||||
* $Id: strncmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strncmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* int *strncmp (const char* s1, const char* s2, size_t n)
|
||||
*/
|
||||
|
||||
.globl _strncmp
|
||||
|
||||
_strncmp:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%esi // s1
|
||||
mov 0xc(%ebp),%edi // s2
|
||||
mov 0x10(%ebp),%ecx // n
|
||||
xor %eax,%eax
|
||||
cld
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsb
|
||||
scasb
|
||||
jne .L3
|
||||
test %eax,%eax // bit 8..31 are set to 0
|
||||
jne .L1
|
||||
.L2:
|
||||
xor %eax,%eax
|
||||
jmp .L4
|
||||
.L3:
|
||||
sbb %eax,%eax
|
||||
or $1,%al
|
||||
.L4:
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcsncmp.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,35 +1,6 @@
|
|||
/*
|
||||
* $Id: strncpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strncpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char *strncpy (char *to, const char *from, size_t n)
|
||||
*/
|
||||
|
||||
.globl _strncpy
|
||||
|
||||
_strncpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
mov 0x10(%ebp),%ecx
|
||||
xor %eax,%eax
|
||||
cld
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsb
|
||||
stosb
|
||||
test %al,%al
|
||||
jne .L1
|
||||
rep stosb
|
||||
.L2:
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcsncpy.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
6
reactos/lib/string/i386/strnlen.s
Normal file
6
reactos/lib/string/i386/strnlen.s
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* $Id: strnlen.s,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tcsnlen.h"
|
||||
|
||||
/* EOF */
|
|
@ -1,33 +1,6 @@
|
|||
/*
|
||||
* $Id: strrchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: strrchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* char* strrchr (const char* s, int c)
|
||||
*/
|
||||
|
||||
.globl _strrchr
|
||||
|
||||
_strrchr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%eax
|
||||
mov $1,%ecx
|
||||
mov %al,%ah
|
||||
cld
|
||||
.L1:
|
||||
lodsb
|
||||
cmp %al,%ah
|
||||
jne .L2
|
||||
mov %esi,%ecx
|
||||
.L2:
|
||||
test %al,%al
|
||||
jne .L1
|
||||
mov %ecx,%eax
|
||||
dec %eax
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#include "tcsrchr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
59
reactos/lib/string/i386/tchar.h
Normal file
59
reactos/lib/string/i386/tchar.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* $Id: tchar.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TCHAR_INC_S__
|
||||
#define __TCHAR_INC_S__
|
||||
|
||||
#ifdef _UNICODE
|
||||
|
||||
#define _tcscat _wcscat
|
||||
#define _tcschr _wcschr
|
||||
#define _tcscmp _wcscmp
|
||||
#define _tcscpy _wcscpy
|
||||
#define _tcslen _wcslen
|
||||
#define _tcsncat _wcsncat
|
||||
#define _tcsncmp _wcsncmp
|
||||
#define _tcsncpy _wcsncpy
|
||||
#define _tcsnlen _wcsnlen
|
||||
#define _tcsrchr _wcsrchr
|
||||
|
||||
#define _tscas scasw
|
||||
#define _tlods lodsw
|
||||
#define _tstos stosw
|
||||
|
||||
#define _tsize $2
|
||||
|
||||
#define _treg(_O_) _O_ ## x
|
||||
|
||||
#define _tdec(_O_) sub $2, _O_
|
||||
#define _tinc(_O_) add $2, _O_
|
||||
|
||||
#else
|
||||
|
||||
#define _tcscat _strcat
|
||||
#define _tcschr _strchr
|
||||
#define _tcscmp _strcmp
|
||||
#define _tcscpy _strcpy
|
||||
#define _tcslen _strlen
|
||||
#define _tcsncat _strncat
|
||||
#define _tcsncmp _strncmp
|
||||
#define _tcsncpy _strncpy
|
||||
#define _tcsnlen _strnlen
|
||||
#define _tcsrchr _strrchr
|
||||
|
||||
#define _tscas scasb
|
||||
#define _tlods lodsb
|
||||
#define _tstos stosb
|
||||
|
||||
#define _tsize $1
|
||||
|
||||
#define _treg(_O_) _O_ ## l
|
||||
|
||||
#define _tdec(_O_) dec _O_
|
||||
#define _tinc(_O_) inc _O_
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
32
reactos/lib/string/i386/tcscat.h
Normal file
32
reactos/lib/string/i386/tcscat.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* $Id: tcscat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcscat
|
||||
|
||||
_tcscat:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %edi
|
||||
mov 0x10(%esp), %esi
|
||||
|
||||
xor %eax, %eax
|
||||
mov $-1, %ecx
|
||||
cld
|
||||
|
||||
repne _tscas
|
||||
_tdec(%edi)
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
_tstos
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
|
||||
mov 0x0C(%esp), %eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
30
reactos/lib/string/i386/tcschr.h
Normal file
30
reactos/lib/string/i386/tcschr.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* $Id: tcschr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcschr
|
||||
|
||||
_tcschr:
|
||||
push %esi
|
||||
mov 0x8(%esp), %esi
|
||||
mov 0xC(%esp), %edx
|
||||
|
||||
cld
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
cmp %_treg(a), %_treg(d)
|
||||
je .L2
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
mov _tsize, %esi
|
||||
|
||||
.L2:
|
||||
mov %esi, %eax
|
||||
_tdec(%eax)
|
||||
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
34
reactos/lib/string/i386/tcscmp.h
Normal file
34
reactos/lib/string/i386/tcscmp.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* $Id: tcscmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcscmp
|
||||
|
||||
_tcscmp:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %esi
|
||||
mov 0x10(%esp), %edi
|
||||
xor %eax, %eax
|
||||
cld
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
_tscas
|
||||
jne .L2
|
||||
test %eax, %eax
|
||||
jne .L1
|
||||
xor %eax, %eax
|
||||
jmp .L3
|
||||
|
||||
.L2:
|
||||
sbb %eax, %eax
|
||||
or $1, %al
|
||||
|
||||
.L3:
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
27
reactos/lib/string/i386/tcscpy.h
Normal file
27
reactos/lib/string/i386/tcscpy.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* $Id: tcscpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcscpy
|
||||
|
||||
_tcscpy:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %edi
|
||||
mov 0x10(%esp), %esi
|
||||
cld
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
_tstos
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
|
||||
mov 0x0C(%esp), %eax
|
||||
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
24
reactos/lib/string/i386/tcslen.h
Normal file
24
reactos/lib/string/i386/tcslen.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* $Id: tcslen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcslen
|
||||
|
||||
_tcslen:
|
||||
push %edi
|
||||
mov 0x8(%esp), %edi
|
||||
xor %eax, %eax
|
||||
mov $-1, %ecx
|
||||
cld
|
||||
|
||||
repne _tscas
|
||||
|
||||
not %ecx
|
||||
dec %ecx
|
||||
|
||||
mov %ecx, %eax
|
||||
pop %edi
|
||||
ret
|
||||
|
||||
/* EOF */
|
42
reactos/lib/string/i386/tcsncat.h
Normal file
42
reactos/lib/string/i386/tcsncat.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* $Id: tcsncat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcsncat
|
||||
|
||||
_tcsncat:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %edi
|
||||
mov 0x10(%esp), %esi
|
||||
cld
|
||||
|
||||
xor %eax, %eax
|
||||
mov $-1, %ecx
|
||||
repne _tscas
|
||||
_tdec(%edi)
|
||||
|
||||
mov 0x14(%esp),%ecx
|
||||
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
_tlods
|
||||
_tstos
|
||||
test %_treg(a), %_treg(a)
|
||||
jne .L1
|
||||
jmp .L3
|
||||
|
||||
.L2:
|
||||
xor %eax, %eax
|
||||
_tstos
|
||||
|
||||
.L3:
|
||||
mov 0x0C(%esp), %eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
|
||||
ret
|
||||
|
||||
/* EOF */
|
40
reactos/lib/string/i386/tcsncmp.h
Normal file
40
reactos/lib/string/i386/tcsncmp.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* $Id: tcsncmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcsncmp
|
||||
|
||||
_tcsncmp:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %esi /* s1 */
|
||||
mov 0x10(%esp), %edi /* s2 */
|
||||
mov 0x14(%esp), %ecx /* n */
|
||||
|
||||
xor %eax,%eax
|
||||
cld
|
||||
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
_tlods
|
||||
_tscas
|
||||
jne .L3
|
||||
test %eax, %eax
|
||||
jne .L1
|
||||
|
||||
.L2:
|
||||
xor %eax, %eax
|
||||
jmp .L4
|
||||
|
||||
.L3:
|
||||
sbb %eax, %eax
|
||||
or $1, %al
|
||||
|
||||
.L4:
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
34
reactos/lib/string/i386/tcsncpy.h
Normal file
34
reactos/lib/string/i386/tcsncpy.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* $Id: tcsncpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcsncpy
|
||||
|
||||
_tcsncpy:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %edi /* s1 */
|
||||
mov 0x10(%esp), %esi /* s2 */
|
||||
mov 0x14(%esp), %ecx /* n */
|
||||
|
||||
xor %eax, %eax
|
||||
cld
|
||||
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
_tlods
|
||||
_tstos
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
rep _tstos
|
||||
|
||||
.L2:
|
||||
mov 0x0C(%esp), %eax
|
||||
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
30
reactos/lib/string/i386/tcsnlen.h
Normal file
30
reactos/lib/string/i386/tcsnlen.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* $Id: tcsnlen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcsnlen
|
||||
|
||||
_tcsnlen:
|
||||
push %edi
|
||||
mov 0x8(%esp), %edi
|
||||
mov 0xC(%esp), %ecx
|
||||
xor %eax, %eax
|
||||
test %ecx, %ecx
|
||||
jz .L1
|
||||
mov %ecx, %edx
|
||||
|
||||
cld
|
||||
|
||||
repne _tscas
|
||||
|
||||
sete %al
|
||||
sub %ecx, %edx
|
||||
sub %eax, %edx
|
||||
mov %edx, %eax
|
||||
|
||||
.L1:
|
||||
pop %edi
|
||||
ret
|
||||
|
||||
/* EOF */
|
31
reactos/lib/string/i386/tcsrchr.h
Normal file
31
reactos/lib/string/i386/tcsrchr.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* $Id: tcsrchr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcsrchr
|
||||
|
||||
_tcsrchr:
|
||||
push %esi
|
||||
mov 0x8(%esp), %esi
|
||||
mov 0xC(%esp), %edx
|
||||
|
||||
cld
|
||||
mov _tsize, %ecx
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
cmp %_treg(a), %_treg(d)
|
||||
jne .L2
|
||||
mov %esi, %ecx
|
||||
|
||||
.L2:
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
|
||||
mov %ecx, %eax
|
||||
_tdec(%eax)
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
|
@ -1,33 +1,7 @@
|
|||
/*
|
||||
* $Id: wcscat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcscat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t *wcscat (wchar_t *dest, const wchar_t *append)
|
||||
*/
|
||||
|
||||
.globl _wcscat
|
||||
|
||||
_wcscat:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
cld
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
repne scasw
|
||||
sub $2,%edi
|
||||
.L1:
|
||||
lodsw
|
||||
stosw
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#define _UNICODE
|
||||
#include "tcscat.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,34 +1,7 @@
|
|||
/*
|
||||
* $Id: wcschr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcschr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t *wcschr (const wchar_t* str, wchar_t ch)
|
||||
*/
|
||||
|
||||
.globl _wcschr
|
||||
|
||||
_wcschr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edx
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%edx
|
||||
cld
|
||||
.L1:
|
||||
lodsw
|
||||
cmp %ax,%dx
|
||||
je .L2
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
mov $2,%esi
|
||||
.L2:
|
||||
mov %esi,%eax
|
||||
sub $2,%eax
|
||||
pop %edx
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcschr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,36 +1,7 @@
|
|||
/*
|
||||
* $Id: wcscmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcscmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* int wcscmp (const wchar_t* s1, const wchar_t* s2)
|
||||
*/
|
||||
|
||||
.globl _wcscmp
|
||||
|
||||
_wcscmp:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%edi
|
||||
cld
|
||||
.L1:
|
||||
lodsw
|
||||
scasw
|
||||
jne .L2
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
xor %eax,%eax
|
||||
jmp .L3
|
||||
.L2:
|
||||
sbb %eax,%eax
|
||||
or $1,%al
|
||||
.L3:
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcscmp.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,7 @@
|
|||
/*
|
||||
* $Id: wcscpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcscpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t* wcscpy (wchar_t* to, const wchar_t* from)
|
||||
*/
|
||||
|
||||
.globl _wcscpy
|
||||
|
||||
_wcscpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
cld
|
||||
.L1:
|
||||
lodsw
|
||||
stosw
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcscpy.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,28 +1,7 @@
|
|||
/*
|
||||
* $Id: wcslen.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcslen.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* size_t wcslen (const wchar_t* str)
|
||||
*/
|
||||
|
||||
.globl _wcslen
|
||||
|
||||
_wcslen:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
cld
|
||||
repne scasw
|
||||
not %ecx
|
||||
dec %ecx
|
||||
mov %ecx,%eax
|
||||
pop %edi
|
||||
leave
|
||||
ret
|
||||
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcslen.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,41 +1,7 @@
|
|||
/*
|
||||
* $Id: wcsncat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcsncat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t *wcsncat (wchar_t *dest, const wchar_t *append, size_t n)
|
||||
*/
|
||||
|
||||
.globl _wcsncat
|
||||
|
||||
_wcsncat:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
cld
|
||||
xor %eax,%eax
|
||||
mov $-1,%ecx
|
||||
repne scasw
|
||||
sub $2,%edi
|
||||
mov 0x10(%ebp),%ecx
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsw
|
||||
stosw
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
jmp .L3
|
||||
.L2:
|
||||
xor %eax,%eax
|
||||
stosw
|
||||
.L3:
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
#define _UNICODE
|
||||
#include "tcsncat.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,40 +1,7 @@
|
|||
/*
|
||||
* $Id: wcsncmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcsncmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* int wcsncmp (const wchar_t* s1, const wchar_t* s2, size_t n)
|
||||
*/
|
||||
|
||||
.globl _wcsncmp
|
||||
|
||||
_wcsncmp:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%edi
|
||||
mov 0xc(%ebp),%ecx
|
||||
cld
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsw
|
||||
scasw
|
||||
jne .L3
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
.L2:
|
||||
xor %eax,%eax
|
||||
jmp .L4
|
||||
.L3:
|
||||
sbb %eax,%eax
|
||||
or $1,%al
|
||||
.L4:
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcsncmp.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
/*
|
||||
* $Id: wcsncpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcsncpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t* wcsncpy (wchar_t* to, const wchar_t* from)
|
||||
*/
|
||||
|
||||
.globl _wcsncpy
|
||||
|
||||
_wcsncpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%esi
|
||||
mov 0x10(%ebp),%ecx
|
||||
cld
|
||||
.L1:
|
||||
dec %ecx
|
||||
js .L2
|
||||
lodsw
|
||||
stosw
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
rep stosw
|
||||
.L2:
|
||||
mov 0x8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcsncpy.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
7
reactos/lib/string/i386/wcsnlen.s
Normal file
7
reactos/lib/string/i386/wcsnlen.s
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $Id: wcsnlen.s,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcsnlen.h"
|
||||
|
||||
/* EOF */
|
|
@ -1,35 +1,7 @@
|
|||
/*
|
||||
* $Id: wcsrchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $
|
||||
/* $Id: wcsrchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* wchar_t *wcsrchr (const wchar_t* str, wchar_t ch)
|
||||
*/
|
||||
|
||||
.globl _wcsrchr
|
||||
|
||||
_wcsrchr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %esi
|
||||
push %edx
|
||||
mov 0x8(%ebp),%esi
|
||||
mov 0xc(%ebp),%edx
|
||||
mov $2,%ecx
|
||||
cld
|
||||
.L1:
|
||||
lodsw
|
||||
cmp %ax,%dx
|
||||
jne .L2
|
||||
mov %esi,%ecx
|
||||
.L2:
|
||||
test %ax,%ax
|
||||
jne .L1
|
||||
mov %ecx,%eax
|
||||
sub $2,%eax
|
||||
pop %edx
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
#define _UNICODE
|
||||
#include "tcsrchr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
/*
|
||||
* $Id: strcat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strcat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcscat.h"
|
||||
|
||||
char* strcat(char* s, const char* append)
|
||||
{
|
||||
char* save = s;
|
||||
|
||||
for (; *s; ++s);
|
||||
while ((*s++ = *append++));
|
||||
return save;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
/*
|
||||
* $Id: strchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#define _XINT int
|
||||
#include <string.h>
|
||||
#include "tcschr.h"
|
||||
|
||||
char *strchr(const char *s, int c)
|
||||
{
|
||||
char cc = c;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
return (char *)s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
return (char *)s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
/*
|
||||
* $Id: strcmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strcmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcscmp.h"
|
||||
|
||||
int strcmp(const char* s1, const char* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == 0)
|
||||
return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return *(unsigned const char*)s1 - *(unsigned const char*)(s2);
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
/*
|
||||
* $Id: strcpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strcpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcscpy.h"
|
||||
|
||||
char* strcpy(char *to, const char *from)
|
||||
{
|
||||
char *save = to;
|
||||
|
||||
for (; (*to = *from); ++from, ++to);
|
||||
return save;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,26 +1,9 @@
|
|||
/*
|
||||
* $Id: strcspn.c,v 1.1 2003/06/09 20:23:06 hbirr Exp $
|
||||
/* $Id: strcspn.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#define _x(_X_) (_X_)
|
||||
#define _strxspn strcspn
|
||||
#include <string.h>
|
||||
#include "strxspn.h"
|
||||
|
||||
size_t strcspn(const char *s1, const char *s2)
|
||||
{
|
||||
unsigned long char_map[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
register unsigned char* str = (unsigned char*)s1;
|
||||
|
||||
while (*s2)
|
||||
{
|
||||
char_map[*(unsigned char*)s2 / 32] |= (1 << (*(unsigned char*)s2 % 32));
|
||||
s2++;
|
||||
}
|
||||
|
||||
while (*str)
|
||||
{
|
||||
if (char_map[*str / 32] & (1 << (*str % 32)))
|
||||
break;
|
||||
str++;
|
||||
}
|
||||
|
||||
return str - (unsigned char*)s1;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,25 +1,7 @@
|
|||
/*
|
||||
* $Id: strlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
|
||||
int strlen(const char* str)
|
||||
{
|
||||
const char* s;
|
||||
|
||||
// DPRINT1("strlen(%x)\n", str);
|
||||
// DPRINT1("%x\n", __builtin_return_address(0));
|
||||
// if (str == (char*)0x6418c4)
|
||||
// {
|
||||
// DPRINT1("%s\n", str);
|
||||
// }
|
||||
if (str == 0)
|
||||
return 0;
|
||||
for (s = str; *s; ++s);
|
||||
return s-str;
|
||||
}
|
||||
#include "tcslen.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,25 +1,7 @@
|
|||
/*
|
||||
* $Id: strncat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strncat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcsncat.h"
|
||||
|
||||
char *
|
||||
strncat(char *dst, const char *src, size_t n)
|
||||
{
|
||||
if (n != 0)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
|
||||
while (*d != 0)
|
||||
d++;
|
||||
do {
|
||||
if ((*d = *s++) == 0)
|
||||
break;
|
||||
d++;
|
||||
} while (--n != 0);
|
||||
*d = 0;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
/*
|
||||
* $Id: strncmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strncmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcsncmp.h"
|
||||
|
||||
int
|
||||
strncmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return *(unsigned const char *)s1 - *(unsigned const char *)--s2;
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
return 0;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
/*
|
||||
* $Id: strncpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strncpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "tcsncpy.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
strncpy(char *dst, const char *src, size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
{
|
||||
while (--n != 0)
|
||||
*d++ = 0;
|
||||
break;
|
||||
}
|
||||
} while (--n != 0);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
/*
|
||||
* $Id: strnlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strnlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tcsnlen.h"
|
||||
|
||||
int strnlen(const char *str, size_t count)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
if (str == 0)
|
||||
return 0;
|
||||
for (s = str; *s && count; ++s, count--);
|
||||
return s-str;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
/*
|
||||
* $Id: strrchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: strrchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#define _XINT int
|
||||
#include <string.h>
|
||||
#include "tcsrchr.h"
|
||||
|
||||
char *
|
||||
strrchr(const char *s, int c)
|
||||
{
|
||||
char cc = c;
|
||||
const char *sp=(char *)0;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
sp = s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
sp = s;
|
||||
return (char *)sp;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
/*
|
||||
* $Id: strspn.c,v 1.1 2003/06/09 20:23:06 hbirr Exp $
|
||||
/* $Id: strspn.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#define _x(_X_) (!(_X_))
|
||||
#define _strxspn strspn
|
||||
#include <string.h>
|
||||
#include "strxspn.h"
|
||||
|
||||
size_t strspn(const char *s1, const char *s2)
|
||||
{
|
||||
unsigned long char_map[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
register unsigned char* str = (unsigned char*)s1;
|
||||
|
||||
while (*s2)
|
||||
{
|
||||
char_map[*(unsigned char*)s2 / 32] |= (1 << (*(unsigned char*)s2 % 32));
|
||||
s2++;
|
||||
}
|
||||
|
||||
while (*str)
|
||||
{
|
||||
if (!(char_map[*str / 32] & (1 << (*str % 32))))
|
||||
break;
|
||||
str++;
|
||||
}
|
||||
return str - (unsigned char*)s1;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
24
reactos/lib/string/strxspn.h
Normal file
24
reactos/lib/string/strxspn.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* $Id: strxspn.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t _strxspn(const char *s1, const char *s2)
|
||||
{
|
||||
unsigned char char_map[1 << CHAR_BIT * sizeof(char)];
|
||||
register unsigned char * us2 = (unsigned char *)s2;
|
||||
register unsigned char * str = (unsigned char *)s1;
|
||||
|
||||
memset(char_map, 0, sizeof(char_map));
|
||||
|
||||
for(; *us2; ++ us2)
|
||||
char_map[*us2 / CHAR_BIT] |= (1 << (*us2 % CHAR_BIT));
|
||||
|
||||
for(; *str; ++ str)
|
||||
if(_x(char_map[*str / CHAR_BIT] & (1 << (*str % CHAR_BIT)))) break;
|
||||
|
||||
return str - (unsigned char*)s1;
|
||||
}
|
||||
|
||||
/* EOF */
|
17
reactos/lib/string/tcscat.h
Normal file
17
reactos/lib/string/tcscat.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* $Id: tcscat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcscat(_TCHAR * s, const _TCHAR * append)
|
||||
{
|
||||
_TCHAR * save = s;
|
||||
|
||||
for(; *s; ++s);
|
||||
|
||||
while((*s++ = *append++));
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
/* EOF */
|
22
reactos/lib/string/tcschr.h
Normal file
22
reactos/lib/string/tcschr.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* $Id: tcschr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcschr(const _TCHAR * s, _XINT c)
|
||||
{
|
||||
_TCHAR cc = c;
|
||||
|
||||
while(*s)
|
||||
{
|
||||
if(*s == cc) return (_TCHAR *)s;
|
||||
|
||||
s++;
|
||||
}
|
||||
|
||||
if(cc == 0) return (_TCHAR *)s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
19
reactos/lib/string/tcscmp.h
Normal file
19
reactos/lib/string/tcscmp.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id: tcscmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
int _tcscmp(const _TCHAR* s1, const _TCHAR* s2)
|
||||
{
|
||||
while(*s1 == *s2)
|
||||
{
|
||||
if(*s1 == 0) return 0;
|
||||
|
||||
s1 ++;
|
||||
s2 ++;
|
||||
}
|
||||
|
||||
return *s1 - *s2;
|
||||
}
|
||||
|
||||
/* EOF */
|
13
reactos/lib/string/tcscpy.h
Normal file
13
reactos/lib/string/tcscpy.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* $Id: tcscpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcscpy(_TCHAR * to, const _TCHAR * from)
|
||||
{
|
||||
_TCHAR *save = to;
|
||||
|
||||
for (; (*to = *from); ++from, ++to);
|
||||
|
||||
return save;
|
||||
}
|
18
reactos/lib/string/tcslen.h
Normal file
18
reactos/lib/string/tcslen.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* $Id: tcslen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tchar.h>
|
||||
|
||||
size_t _tcslen(const _TCHAR * str)
|
||||
{
|
||||
const _TCHAR * s;
|
||||
|
||||
if(str == 0) return 0;
|
||||
|
||||
for(s = str; *s; ++ s);
|
||||
|
||||
return s - str;
|
||||
}
|
||||
|
||||
/* EOF */
|
30
reactos/lib/string/tcsncat.h
Normal file
30
reactos/lib/string/tcsncat.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* $Id: tcsncat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcsncat(_TCHAR * dst, const _TCHAR * src, size_t n)
|
||||
{
|
||||
if(n != 0)
|
||||
{
|
||||
_TCHAR * d = dst;
|
||||
const _TCHAR * s = src;
|
||||
|
||||
while(*d != 0) ++ d;
|
||||
|
||||
do
|
||||
{
|
||||
if((*d = *s++) == 0) break;
|
||||
|
||||
++ d;
|
||||
}
|
||||
while (--n != 0);
|
||||
|
||||
*d = 0;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* EOF */
|
21
reactos/lib/string/tcsncmp.h
Normal file
21
reactos/lib/string/tcsncmp.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* $Id: tcsncmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tchar.h>
|
||||
|
||||
int _tcsncmp(const _TCHAR * s1, const _TCHAR * s2, size_t n)
|
||||
{
|
||||
if(n == 0) return 0;
|
||||
|
||||
do
|
||||
{
|
||||
if(*s1 != *s2 ++) return *s1 - *-- s2;
|
||||
if(*s1 ++ == 0) break;
|
||||
}
|
||||
while (-- n != 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
28
reactos/lib/string/tcsncpy.h
Normal file
28
reactos/lib/string/tcsncpy.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* $Id: tcsncpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n)
|
||||
{
|
||||
if(n != 0)
|
||||
{
|
||||
_TCHAR * d = dst;
|
||||
const _TCHAR * s = src;
|
||||
|
||||
do
|
||||
{
|
||||
if((*d ++ = *s ++) == 0)
|
||||
{
|
||||
while (-- n != 0) *d ++ = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(-- n != 0);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* EOF */
|
18
reactos/lib/string/tcsnlen.h
Normal file
18
reactos/lib/string/tcsnlen.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* $Id: tcsnlen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tchar.h>
|
||||
|
||||
int _tcsnlen(const _TCHAR * str, size_t count)
|
||||
{
|
||||
const _TCHAR * s;
|
||||
|
||||
if(str == 0) return 0;
|
||||
|
||||
for(s = str; *s && count; ++ s, -- count);
|
||||
|
||||
return s - str;
|
||||
}
|
||||
|
||||
/* EOF */
|
22
reactos/lib/string/tcsrchr.h
Normal file
22
reactos/lib/string/tcsrchr.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* $Id: tcsrchr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
_TCHAR * _tcsrchr(const _TCHAR * s, _XINT c)
|
||||
{
|
||||
_TCHAR cc = c;
|
||||
const _TCHAR * sp = (_TCHAR *)0;
|
||||
|
||||
while(*s)
|
||||
{
|
||||
if(*s == cc) sp = s;
|
||||
s ++;
|
||||
}
|
||||
|
||||
if(cc == 0) sp = s;
|
||||
|
||||
return (_TCHAR *)sp;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,14 +1,8 @@
|
|||
/*
|
||||
* $Id: wcscat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcscat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcscat.h"
|
||||
|
||||
wchar_t* wcscat(wchar_t* s, const wchar_t* append)
|
||||
{
|
||||
wchar_t* save = s;
|
||||
|
||||
for (; *s; ++s);
|
||||
while ((*s++ = *append++));
|
||||
return save;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
/*
|
||||
* $Id: wcschr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcschr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
wchar_t *wcschr(const wchar_t *s, wchar_t c)
|
||||
{
|
||||
wchar_t cc = c;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
return (wchar_t *)s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
return (wchar_t *)s;
|
||||
return 0;
|
||||
}
|
||||
#define _UNICODE
|
||||
#define _XINT wchar_t
|
||||
#include <wchar.h>
|
||||
#include "tcschr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
/*
|
||||
* $Id: wcscmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcscmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcscmp.h"
|
||||
|
||||
int wcscmp(const wchar_t* s1, const wchar_t* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == 0)
|
||||
return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return *s1 - *s2;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
/*
|
||||
* $Id: wcscpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcscpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcscpy.h"
|
||||
|
||||
wchar_t* wcscpy(wchar_t *to, const wchar_t *from)
|
||||
{
|
||||
wchar_t *save = to;
|
||||
|
||||
for (; (*to = *from); ++from, ++to);
|
||||
return save;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
/*
|
||||
* $Id: wcslen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcslen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
size_t wcslen(const wchar_t* str)
|
||||
{
|
||||
const wchar_t* s;
|
||||
|
||||
if (str == 0)
|
||||
return 0;
|
||||
for (s = str; *s; ++s);
|
||||
return s-str;
|
||||
}
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcslen.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,25 +1,8 @@
|
|||
/*
|
||||
* $Id: wcsncat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcsncat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcsncat.h"
|
||||
|
||||
wchar_t *
|
||||
wcsncat(wchar_t *dst, const wchar_t *src, size_t n)
|
||||
{
|
||||
if (n != 0)
|
||||
{
|
||||
wchar_t *d = dst;
|
||||
const wchar_t *s = src;
|
||||
|
||||
while (*d != 0)
|
||||
d++;
|
||||
do {
|
||||
if ((*d = *s++) == 0)
|
||||
break;
|
||||
d++;
|
||||
} while (--n != 0);
|
||||
*d = 0;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
/*
|
||||
* $Id: wcsncmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcsncmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcsncmp.h"
|
||||
|
||||
int
|
||||
wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return *s1 - *--s2;
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
return 0;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,24 +1,8 @@
|
|||
/*
|
||||
* $Id: wcsncpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcsncpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcsncpy.h"
|
||||
|
||||
wchar_t *
|
||||
wcsncpy(wchar_t *dst, const wchar_t *src, size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
wchar_t *d = dst;
|
||||
const wchar_t *s = src;
|
||||
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
{
|
||||
while (--n != 0)
|
||||
*d++ = 0;
|
||||
break;
|
||||
}
|
||||
} while (--n != 0);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
/* EOF */
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
/*
|
||||
* $Id: wcsnlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcsnlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int wcsnlen(const wchar_t *str, size_t count)
|
||||
{
|
||||
const wchar_t *s;
|
||||
|
||||
if (str == 0)
|
||||
return 0;
|
||||
for (s = str; *s && count; ++s, count--);
|
||||
return s-str;
|
||||
}
|
||||
#define _UNICODE
|
||||
#include <wchar.h>
|
||||
#include "tcsnlen.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
/*
|
||||
* $Id: wcsrchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $
|
||||
/* $Id: wcsrchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
wchar_t *
|
||||
wcsrchr(const wchar_t *s, wchar_t c)
|
||||
{
|
||||
wchar_t cc = c;
|
||||
const wchar_t *sp=(wchar_t *)0;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
sp = s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
sp = s;
|
||||
return (wchar_t *)sp;
|
||||
}
|
||||
#define _UNICODE
|
||||
#define _XINT wchar_t
|
||||
#include <wchar.h>
|
||||
#include "tcsrchr.h"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: timer.c,v 1.6 2003/04/26 01:19:31 sedwards Exp $
|
||||
/* $Id: timer.c,v 1.7 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/misc/dde.c
|
||||
|
@ -41,19 +41,7 @@ KillTimer(
|
|||
HWND hWnd,
|
||||
UINT_PTR IDEvent)
|
||||
{
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtUserKillTimer(hWnd, IDEvent);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlNtStatusToDosError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
return NtUserKillTimer(hWnd, IDEvent);
|
||||
}
|
||||
|
||||
UINT_PTR
|
||||
|
@ -64,19 +52,6 @@ SetTimer(
|
|||
UINT Period,
|
||||
TIMERPROC TimerFunc)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtUserSetTimer(hWnd, &IDEvent, Period, TimerFunc);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlNtStatusToDosError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hWnd == NULL)
|
||||
return IDEvent;
|
||||
|
||||
return TRUE;
|
||||
return NtUserSetTimer(hWnd, IDEvent, Period, TimerFunc);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: paint.c,v 1.14 2003/05/26 18:52:37 gvg Exp $
|
||||
/* $Id: paint.c,v 1.15 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/input.c
|
||||
|
@ -109,15 +109,7 @@ RedrawWindow(
|
|||
HRGN hrgnUpdate,
|
||||
UINT flags)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
}
|
||||
|
||||
return NT_SUCCESS(Status);
|
||||
return NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags);
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: timer.c,v 1.4 2003/06/05 22:47:47 gdalsnes Exp $
|
||||
/* $Id: timer.c,v 1.5 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -166,129 +166,134 @@ RemoveTimersThread(HANDLE ThreadID)
|
|||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
UINT_PTR
|
||||
STDCALL
|
||||
NtUserSetTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR * IDEvent,
|
||||
UINT Period,
|
||||
TIMERPROC TimerFunc
|
||||
)
|
||||
NtUserSetTimer
|
||||
(
|
||||
HWND hWnd,
|
||||
UINT_PTR nIDEvent,
|
||||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc
|
||||
)
|
||||
{
|
||||
ULONG Index;
|
||||
PMSG_TIMER_ENTRY MsgTimer = NULL;
|
||||
PMSG_TIMER_ENTRY NewTimer;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
HANDLE ThreadID;
|
||||
ULONG Index;
|
||||
PMSG_TIMER_ENTRY MsgTimer = NULL;
|
||||
PMSG_TIMER_ENTRY NewTimer;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
HANDLE ThreadID;
|
||||
|
||||
//FIXME: WINE: window must be owned by the calling thread
|
||||
//FIXME: WINE: window must be owned by the calling thread
|
||||
#if 0
|
||||
if (hWnd && !(hWnd = WIN_IsCurrentThread(hWnd))
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if(hWnd && !(hWnd = WIN_IsCurrentThread(hWnd))
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
#endif
|
||||
|
||||
ThreadID = PsGetCurrentThreadId();
|
||||
KeQuerySystemTime(&CurrentTime);
|
||||
ExAcquireFastMutex(&Mutex);
|
||||
ThreadID = PsGetCurrentThreadId();
|
||||
KeQuerySystemTime(&CurrentTime);
|
||||
ExAcquireFastMutex(&Mutex);
|
||||
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
//find a free, handle-less timer id
|
||||
Index = RtlFindClearBitsAndSet(&HandleLessTimersBitMap, 1, HintIndex);
|
||||
if (Index == -1)
|
||||
{
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
*IDEvent = HintIndex = Index + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//remove timer if allready in the queue
|
||||
MsgTimer = RemoveTimer(hWnd, *IDEvent, ThreadID);
|
||||
}
|
||||
|
||||
if (MsgTimer)
|
||||
{
|
||||
//modify existing (removed) timer
|
||||
NewTimer = MsgTimer;
|
||||
|
||||
NewTimer->Period = Period;
|
||||
NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (Period * 10000);
|
||||
NewTimer->Msg.lParam = (LPARAM)TimerFunc;
|
||||
}
|
||||
else
|
||||
{
|
||||
//FIXME: use lookaside?
|
||||
NewTimer = ExAllocatePool(PagedPool, sizeof(MSG_TIMER_ENTRY));
|
||||
|
||||
NewTimer->Msg.hwnd = hWnd;
|
||||
NewTimer->Msg.message = WM_TIMER;
|
||||
NewTimer->Msg.wParam = (WPARAM)*IDEvent;
|
||||
NewTimer->Msg.lParam = (LPARAM)TimerFunc;
|
||||
NewTimer->Period = Period;
|
||||
NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (Period * 10000);
|
||||
NewTimer->ThreadID = ThreadID;
|
||||
}
|
||||
|
||||
if (InsertTimerAscendingOrder(NewTimer))
|
||||
{
|
||||
//new timer is first in queue and expires first
|
||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
||||
}
|
||||
if(hWnd == NULL)
|
||||
{
|
||||
/* find a free, handle-less timer id */
|
||||
Index = RtlFindClearBitsAndSet(&HandleLessTimersBitMap, 1, HintIndex);
|
||||
|
||||
if(Index == -1)
|
||||
{
|
||||
/* FIXME: set the last error */
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
++ Index;
|
||||
HintIndex = Index;
|
||||
return Index;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* remove timer if already in the queue */
|
||||
MsgTimer = RemoveTimer(hWnd, nIDEvent, ThreadID);
|
||||
}
|
||||
|
||||
if(MsgTimer)
|
||||
{
|
||||
/* modify existing (removed) timer */
|
||||
NewTimer = MsgTimer;
|
||||
|
||||
NewTimer->Period = uElapse;
|
||||
NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (uElapse * 10000);
|
||||
NewTimer->Msg.lParam = (LPARAM)lpTimerFunc;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: use lookaside? */
|
||||
NewTimer = ExAllocatePool(PagedPool, sizeof(MSG_TIMER_ENTRY));
|
||||
|
||||
NewTimer->Msg.hwnd = hWnd;
|
||||
NewTimer->Msg.message = WM_TIMER;
|
||||
NewTimer->Msg.wParam = (WPARAM)nIDEvent;
|
||||
NewTimer->Msg.lParam = (LPARAM)lpTimerFunc;
|
||||
NewTimer->Period = uElapse;
|
||||
NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (uElapse * 10000);
|
||||
NewTimer->ThreadID = ThreadID;
|
||||
}
|
||||
|
||||
if(InsertTimerAscendingOrder(NewTimer))
|
||||
{
|
||||
/* new timer is first in queue and expires first */
|
||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
||||
}
|
||||
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserKillTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR IDEvent)
|
||||
NtUserKillTimer
|
||||
(
|
||||
HWND hWnd,
|
||||
UINT_PTR uIDEvent
|
||||
)
|
||||
{
|
||||
PMSG_TIMER_ENTRY MsgTimer;
|
||||
|
||||
ExAcquireFastMutex(&Mutex);
|
||||
PMSG_TIMER_ENTRY MsgTimer;
|
||||
|
||||
ExAcquireFastMutex(&Mutex);
|
||||
|
||||
//handle-less timer?
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
if (!RtlAreBitsSet(&HandleLessTimersBitMap, IDEvent - 1, 1))
|
||||
{
|
||||
//bit was not set
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
/* handle-less timer? */
|
||||
if(hWnd == NULL)
|
||||
{
|
||||
if(!RtlAreBitsSet(&HandleLessTimersBitMap, uIDEvent - 1, 1))
|
||||
{
|
||||
/* bit was not set */
|
||||
/* FIXME: set the last error */
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RtlClearBits(&HandleLessTimersBitMap, IDEvent - 1, 1);
|
||||
}
|
||||
RtlClearBits(&HandleLessTimersBitMap, uIDEvent - 1, 1);
|
||||
}
|
||||
|
||||
MsgTimer = RemoveTimer(hWnd, IDEvent, PsGetCurrentThreadId());
|
||||
MsgTimer = RemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId());
|
||||
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
ExReleaseFastMutex(&Mutex);
|
||||
|
||||
if (MsgTimer == NULL)
|
||||
{
|
||||
//didn't find timer
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if(MsgTimer == NULL)
|
||||
{
|
||||
/* didn't find timer */
|
||||
/* FIXME: set the last error */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//FIXME: use lookaside?
|
||||
ExFreePool(MsgTimer);
|
||||
/* FIXME: use lookaside? */
|
||||
ExFreePool(MsgTimer);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetSystemTimer(
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.59 2003/07/05 16:04:01 chorns Exp $
|
||||
/* $Id: window.c,v 1.60 2003/07/06 23:04:19 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1438,24 +1438,46 @@ NtUserRealChildWindowFromPoint(DWORD Unknown0,
|
|||
return 0;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserRedrawWindow
|
||||
(
|
||||
HWND hWnd,
|
||||
CONST RECT *lprcUpdate,
|
||||
HRGN hrgnUpdate,
|
||||
UINT flags
|
||||
)
|
||||
{
|
||||
RECT SafeUpdateRect;
|
||||
NTSTATUS Status;
|
||||
RECT SafeUpdateRect;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (NULL != lprcUpdate)
|
||||
{
|
||||
Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT) lprcUpdate, sizeof(RECT));
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
if(NULL != lprcUpdate)
|
||||
{
|
||||
Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT)lprcUpdate, sizeof(RECT));
|
||||
|
||||
return PaintRedrawWindow(hWnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect, hrgnUpdate,
|
||||
flags, 0) ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER;
|
||||
;
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
/* FIXME: set last error */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Status = PaintRedrawWindow
|
||||
(
|
||||
hWnd,
|
||||
NULL == lprcUpdate ? NULL : &SafeUpdateRect,
|
||||
hrgnUpdate,
|
||||
flags,
|
||||
0
|
||||
);
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
/* FIXME: set last error */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT STDCALL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: helper.mk,v 1.38 2003/06/17 19:40:07 hbirr Exp $
|
||||
# $Id: helper.mk,v 1.39 2003/07/06 23:04:19 hyperion Exp $
|
||||
#
|
||||
# Helper makefile for ReactOS modules
|
||||
# Variables this makefile accepts:
|
||||
|
@ -530,7 +530,7 @@ TARGET_CLEAN += $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME)
|
|||
|
||||
all: $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME)
|
||||
|
||||
$(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(TARGET_OBJECTS)
|
||||
$(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(TARGET_OBJECTS) $(MK_DEFNAME)
|
||||
$(DLLTOOL) \
|
||||
--dllname $(MK_FULLNAME) \
|
||||
--def $(MK_DEFNAME) \
|
||||
|
@ -554,12 +554,14 @@ ifeq ($(MK_MODE),user)
|
|||
|
||||
ifeq ($(MK_EXETYPE),dll)
|
||||
TARGET_LFLAGS += -mdll -Wl,--image-base,$(TARGET_BASE)
|
||||
MK_EXTRADEP := $(MK_EDFNAME)
|
||||
MK_EXTRACMD2 := -Wl,temp.exp
|
||||
else
|
||||
MK_EXTRADEP :=
|
||||
MK_EXTRACMD2 :=
|
||||
endif
|
||||
|
||||
$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
|
||||
$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS)
|
||||
ifeq ($(MK_EXETYPE),dll)
|
||||
$(CC) -Wl,--base-file,base.tmp \
|
||||
-Wl,--entry,$(TARGET_ENTRY) \
|
||||
|
@ -584,7 +586,7 @@ else
|
|||
$(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
|
||||
endif
|
||||
|
||||
$(MK_FULLNAME): $(MK_NOSTRIPNAME)
|
||||
$(MK_FULLNAME): $(MK_NOSTRIPNAME) $(MK_EXTRADEP)
|
||||
ifeq ($(MK_EXETYPE),dll)
|
||||
$(CC) -Wl,--base-file,base.tmp \
|
||||
-Wl,--entry,$(TARGET_ENTRY) \
|
||||
|
@ -611,11 +613,13 @@ ifeq ($(MK_MODE),kernel)
|
|||
|
||||
ifeq ($(MK_IMPLIB),yes)
|
||||
MK_EXTRACMD := --def $(MK_EDFNAME)
|
||||
MK_EXTRADEP := $(MK_EDFNAME)
|
||||
else
|
||||
MK_EXTRACMD :=
|
||||
MK_EXTRADEP :=
|
||||
endif
|
||||
|
||||
$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
|
||||
$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS)
|
||||
$(CC) -Wl,--base-file,base.tmp \
|
||||
-Wl,--entry,$(TARGET_ENTRY) \
|
||||
$(TARGET_LFLAGS) \
|
||||
|
@ -645,7 +649,7 @@ else
|
|||
$(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
|
||||
endif
|
||||
|
||||
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME)
|
||||
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS) $(MK_NOSTRIPNAME)
|
||||
$(LD) -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS)
|
||||
$(STRIP) --strip-debug $(MK_STRIPPED_OBJECT)
|
||||
$(CC) -Wl,--base-file,base.tmp \
|
||||
|
|
Loading…
Reference in a new issue