Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6da4c275
Commit
6da4c275
authored
Mar 19, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Rtl*ByteSwap() functions, based on a patch by Jon
Griffiths.
parent
ccf2f616
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+3
-0
rtl.c
dlls/ntdll/rtl.c
+47
-0
winternl.h
include/winternl.h
+17
-0
No files found.
dlls/ntdll/ntdll.spec
View file @
6da4c275
...
...
@@ -530,6 +530,8 @@
@ stdcall RtlTimeToSecondsSince1970(ptr ptr) RtlTimeToSecondsSince1970
@ stdcall RtlTimeToSecondsSince1980(ptr ptr) RtlTimeToSecondsSince1980
@ stdcall RtlTimeToTimeFields (long long) RtlTimeToTimeFields
@ cdecl -i386 -norelay RtlUlongByteSwap() RtlUlongByteSwap
@ cdecl -ret64 RtlUlonglongByteSwap(long long) RtlUlonglongByteSwap
@ stdcall RtlUnicodeStringToAnsiSize(ptr) RtlUnicodeStringToAnsiSize
@ stdcall RtlUnicodeStringToAnsiString(ptr ptr long) RtlUnicodeStringToAnsiString
@ stub RtlUnicodeStringToCountedOemString
...
...
@@ -554,6 +556,7 @@
@ stdcall RtlUpperChar(long) RtlUpperChar
@ stdcall RtlUpperString(ptr ptr) RtlUpperString
@ stub RtlUsageHeap
@ cdecl -i386 -norelay RtlUshortByteSwap() RtlUshortByteSwap
@ stub RtlValidAcl
@ stdcall RtlValidSecurityDescriptor(ptr) RtlValidSecurityDescriptor
@ stdcall RtlValidSid(ptr) RtlValidSid
...
...
dlls/ntdll/rtl.c
View file @
6da4c275
...
...
@@ -682,3 +682,50 @@ DWORD WINAPI RtlComputeCrc32(DWORD dwInitial, PBYTE pData, INT iLen)
}
return
~
crc
;
}
/*************************************************************************
* RtlUlonglongByteSwap [NTDLL.@]
*
* Swap the bytes of an unsigned long long value.
*
* PARAMS
* i [I] Value to swap bytes of
*
* RETURNS
* The value with its bytes swapped.
*/
ULONGLONG
__cdecl
RtlUlonglongByteSwap
(
ULONGLONG
i
)
{
return
((
ULONGLONG
)
RtlUlongByteSwap
(
i
)
<<
32
)
|
RtlUlongByteSwap
(
i
>>
32
);
}
/*************************************************************************
* RtlUlongByteSwap [NTDLL.@]
*
* Swap the bytes of an unsigned int value.
*
* NOTES
* ix86 version takes argument in %ecx. Other systems use the inline version.
*/
#ifdef __i386__
__ASM_GLOBAL_FUNC
(
RtlUlongByteSwap
,
"movl %ecx,%eax
\n\t
"
"bswap %eax
\n\t
"
"ret"
);
#endif
/*************************************************************************
* RtlUshortByteSwap [NTDLL.@]
*
* Swap the bytes of an unsigned short value.
*
* NOTES
* i386 version takes argument in %cx. Other systems use the inline version.
*/
#ifdef __i386__
__ASM_GLOBAL_FUNC
(
RtlUshortByteSwap
,
"movb %ch,%al
\n\t
"
"movb %cl,%ah
\n\t
"
"ret"
);
#endif
include/winternl.h
View file @
6da4c275
...
...
@@ -1050,6 +1050,7 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,PULONG);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
LARGE_INTEGER
*
,
LPDWORD
);
BOOL
WINAPI
RtlTryEnterCriticalSection
(
RTL_CRITICAL_SECTION
*
);
ULONGLONG
__cdecl
RtlUlonglongByteSwap
(
ULONGLONG
);
DWORD
WINAPI
RtlUnicodeStringToAnsiSize
(
const
UNICODE_STRING
*
);
NTSTATUS
WINAPI
RtlUnicodeStringToAnsiString
(
PANSI_STRING
,
PCUNICODE_STRING
,
BOOLEAN
);
NTSTATUS
WINAPI
RtlUnicodeStringToInteger
(
const
UNICODE_STRING
*
,
ULONG
,
ULONG
*
);
...
...
@@ -1134,6 +1135,22 @@ inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
} while (0)
/* These are implemented as __fastcall, so we can't let Winelib apps link with them */
inline
static
USHORT
RtlUshortByteSwap
(
USHORT
s
)
{
return
(
s
>>
8
)
|
(
s
<<
8
);
}
inline
static
ULONG
RtlUlongByteSwap
(
ULONG
i
)
{
#if defined(__i386__) && defined(__GNUC__)
ULONG
ret
;
__asm__
(
"bswap %0"
:
"=r"
(
ret
)
:
"0"
(
i
)
);
return
ret
;
#else
return
((
ULONG
)
RtlUshortByteSwap
(
i
)
<<
16
)
|
RtlUshortByteSwap
(
i
>>
16
);
#endif
}
/*************************************************************************
* Loader functions and structures.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment