Commit 026d9db8 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- sorted API by groups

- new stubs: NtQueryDirectoryFile, ZwQueryDirectoryFile - impl.: RtlAllocateHeap, RtlCreateHeap, RtlDestroyHeap, RtlFreeHeap, RtlGetDaclSecurityDescriptor, RtlGetSaclSecurityDescriptor - impl. by Rex Jolliff (rex@lvcablemodem.com): RtlTimeToTimeFields, RtlTimeFieldsToTime
parent 7f0c5f3e
......@@ -6,9 +6,15 @@ VPATH = @srcdir@
MODULE = ntdll
C_SRCS = \
file.c \
nt.c \
om.c \
reg.c \
rtl.c
rtl.c \
rtlstr.c \
sec.c \
sync.c \
time.c
all: $(MODULE).o
......
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "ntddk.h"
/**************************************************************************
* NtOpenFile [NTDLL.127]
* FUNCTION: Opens a file
* ARGUMENTS:
* FileHandle Variable that receives the file handle on return
* DesiredAccess Access desired by the caller to the file
* ObjectAttributes Structue describing the file to be opened
* IoStatusBlock Receives details about the result of the operation
* ShareAccess Type of shared access the caller requires
* OpenOptions Options for the file open
*/
NTSTATUS WINAPI NtOpenFile(
OUT PHANDLE FileHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
ULONG ShareAccess,
ULONG OpenOptions)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx) stub\n",
FileHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
IoStatusBlock, ShareAccess, OpenOptions);
return 0;
}
/**************************************************************************
* NtCreateFile [NTDLL.73]
* FUNCTION: Either causes a new file or directory to be created, or it opens
* an existing file, device, directory or volume, giving the caller a handle
* for the file object. This handle can be used by subsequent calls to
* manipulate data within the file or the file object's state of attributes.
* ARGUMENTS:
* FileHandle Points to a variable which receives the file handle on return
* DesiredAccess Desired access to the file
* ObjectAttributes Structure describing the file
* IoStatusBlock Receives information about the operation on return
* AllocationSize Initial size of the file in bytes
* FileAttributes Attributes to create the file with
* ShareAccess Type of shared access the caller would like to the file
* CreateDisposition Specifies what to do, depending on whether the file already exists
* CreateOptions Options for creating a new file
* EaBuffer Undocumented
* EaLength Undocumented
*/
NTSTATUS WINAPI NtCreateFile(
OUT PHANDLE FileHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
PLARGE_INTEGER AllocateSize,
ULONG FileAttributes,
ULONG ShareAccess,
ULONG CreateDisposition,
ULONG CreateOptions,
PVOID EaBuffer,
ULONG EaLength)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n",
FileHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
IoStatusBlock,AllocateSize,FileAttributes,
ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength);
return 0;
}
/******************************************************************************
* NtReadFile [NTDLL]
* ZwReadFile
*
* Parameters
* HANDLE32 FileHandle
* HANDLE32 Event OPTIONAL
* PIO_APC_ROUTINE ApcRoutine OPTIONAL
* PVOID ApcContext OPTIONAL
* PIO_STATUS_BLOCK IoStatusBlock
* PVOID Buffer
* ULONG Length
* PLARGE_INTEGER ByteOffset OPTIONAL
* PULONG Key OPTIONAL
*/
NTSTATUS WINAPI NtReadFile (
HANDLE FileHandle,
HANDLE EventHandle,
PIO_APC_ROUTINE ApcRoutine,
PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock,
PVOID Buffer,
ULONG Length,
PLARGE_INTEGER ByteOffset,
PULONG Key)
{
FIXME(ntdll,"(0x%08x,0x%08x,%p,%p,%p,%p,0x%08lx,%p,%p),stub!\n",
FileHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,Buffer,Length,ByteOffset,Key);
return 0;
}
/**************************************************************************
* NtDeviceIoControlFile [NTDLL.94]
*/
NTSTATUS WINAPI NtDeviceIoControlFile(
IN HANDLE DeviceHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
IN PVOID UserApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ULONG IoControlCode,
IN PVOID InputBuffer,
IN ULONG InputBufferSize,
OUT PVOID OutputBuffer,
IN ULONG OutputBufferSize)
{
FIXME(ntdll,"(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): empty stub\n",
DeviceHandle, Event, UserApcRoutine, UserApcContext,
IoStatusBlock, IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
return 0;
}
/******************************************************************************
* NtFsControlFile [NTDLL.108]
*/
NTSTATUS WINAPI NtFsControlFile(
IN HANDLE DeviceHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ULONG IoControlCode,
IN PVOID InputBuffer,
IN ULONG InputBufferSize,
OUT PVOID OutputBuffer,
IN ULONG OutputBufferSize)
{
FIXME(ntdll,"(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): stub\n",
DeviceHandle,Event,ApcRoutine,ApcContext,IoStatusBlock,IoControlCode,
InputBuffer,InputBufferSize,OutputBuffer,OutputBufferSize);
return 0;
}
/******************************************************************************
* NtSetVolumeInformationFile [NTDLL]
*/
NTSTATUS WINAPI NtSetVolumeInformationFile(
IN HANDLE FileHandle,
IN PVOID VolumeInformationClass,
PVOID VolumeInformation,
ULONG Length)
{
FIXME(ntdll,"(0x%08x,%p,%p,0x%08lx) stub\n",
FileHandle,VolumeInformationClass,VolumeInformation,Length);
return 0;
}
/******************************************************************************
* NtQueryInformationFile [NTDLL]
*/
NTSTATUS WINAPI NtQueryInformationFile(
HANDLE FileHandle,
PIO_STATUS_BLOCK IoStatusBlock,
PVOID FileInformation,
ULONG Length,
FILE_INFORMATION_CLASS FileInformationClass)
{
FIXME(ntdll,"(0x%08x,%p,%p,0x%08lx,0x%08x),stub!\n",
FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
return 0;
}
/******************************************************************************
* NtSetInformationFile [NTDLL]
*/
NTSTATUS WINAPI NtSetInformationFile(
HANDLE FileHandle,
PIO_STATUS_BLOCK IoStatusBlock,
PVOID FileInformation,
ULONG Length,
FILE_INFORMATION_CLASS FileInformationClass)
{
FIXME(ntdll,"(0x%08x,%p,%p,0x%08lx,0x%08x)\n",
FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
return 0;
}
/******************************************************************************
* NtQueryDirectoryFile [NTDLL]
* ZwQueryDirectoryFile
*/
NTSTATUS WINAPI NtQueryDirectoryFile(
IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass,
IN BOOLEAN ReturnSingleEntry,
IN PUNICODE_STRING FileName OPTIONAL,
IN BOOLEAN RestartScan)
{
FIXME (ntdll,"(0x%08x 0x%08x %p %p %p %p 0x%08lx 0x%08x 0x%08x %p 0x%08x\n",
FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation,
Length, FileInformationClass, ReturnSingleEntry,
debugstr_w(FileName->Buffer),RestartScan);
return 0;
}
/*
* Object management functions
*/
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "ntddk.h"
/* move to somewhere */
typedef void * POBJDIR_INFORMATION;
/*
* Generic object functions
*/
/******************************************************************************
* NtQueryObject [NTDLL.161]
*/
NTSTATUS WINAPI NtQueryObject(
IN HANDLE ObjectHandle,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength)
{
FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx,%p): stub\n",
ObjectHandle, ObjectInformationClass, ObjectInformation, Length, ResultLength);
return 0;
}
/******************************************************************************
* NtQuerySecurityObject [NTDLL]
*/
NTSTATUS WINAPI NtQuerySecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
{
FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx) stub!\n",x1,x2,x3,x4,x5);
return 0;
}
/******************************************************************************
* NtDuplicateObject [NTDLL]
*/
NTSTATUS WINAPI NtDuplicateObject(
IN HANDLE SourceProcessHandle,
IN PHANDLE SourceHandle,
IN HANDLE TargetProcessHandle,
OUT PHANDLE TargetHandle,
IN ACCESS_MASK DesiredAccess,
IN BOOLEAN InheritHandle,
ULONG Options)
{
FIXME(ntdll,"(0x%08x,%p,0x%08x,%p,0x%08lx,0x%08x,0x%08lx) stub!\n",
SourceProcessHandle,SourceHandle,TargetProcessHandle,TargetHandle,
DesiredAccess,InheritHandle,Options);
*TargetHandle = 0;
return 0;
}
/**************************************************************************
* NtClose [NTDLL.65]
* FUNCTION: Closes a handle reference to an object
* ARGUMENTS:
* Handle handle to close
*/
NTSTATUS WINAPI NtClose(
HANDLE Handle)
{
FIXME(ntdll,"(0x%08x),stub!\n",Handle);
return 1;
}
/******************************************************************************
* NtWaitForSingleObject [NTDLL]
*/
NTSTATUS WINAPI NtWaitForSingleObject(
IN PHANDLE Object,
IN BOOLEAN Alertable,
IN PLARGE_INTEGER Time)
{
FIXME(ntdll,"(%p,0x%08x,%p),stub!\n",Object,Alertable,Time);
return 0;
}
/*
* Directory functions
*/
/**************************************************************************
* NtOpenDirectoryObject [NTDLL.124]
* FUNCTION: Opens a namespace directory object
* ARGUMENTS:
* DirectoryHandle Variable which receives the directory handle
* DesiredAccess Desired access to the directory
* ObjectAttributes Structure describing the directory
* RETURNS: Status
*/
NTSTATUS WINAPI NtOpenDirectoryObject(
PHANDLE DirectoryHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s)): stub\n",
DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
}
/******************************************************************************
* NtCreateDirectoryObject [NTDLL]
*/
NTSTATUS WINAPI NtCreateDirectoryObject(
PHANDLE DirectoryHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n",
DirectoryHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
}
/******************************************************************************
* NtQueryDirectoryObject [NTDLL.149]
* FUNCTION: Reads information from a namespace directory
* ARGUMENTS:
* DirObjInformation Buffer to hold the data read
* BufferLength Size of the buffer in bytes
* GetNextIndex If TRUE then set ObjectIndex to the index of the next object
* If FALSE then set ObjectIndex to the number of objects in the directory
* IgnoreInputIndex If TRUE start reading at index 0
* If FALSE start reading at the index specified by object index
* ObjectIndex Zero based index into the directory, interpretation depends on IgnoreInputIndex and GetNextIndex
* DataWritten Caller supplied storage for the number of bytes written (or NULL)
*/
NTSTATUS WINAPI NtQueryDirectoryObject(
IN HANDLE DirObjHandle,
OUT POBJDIR_INFORMATION DirObjInformation,
IN ULONG BufferLength,
IN BOOLEAN GetNextIndex,
IN BOOLEAN IgnoreInputIndex,
IN OUT PULONG ObjectIndex,
OUT PULONG DataWritten OPTIONAL)
{
FIXME(ntdll,"(0x%08x,%p,0x%08lx,0x%08x,0x%08x,%p,%p) stub\n",
DirObjHandle, DirObjInformation, BufferLength, GetNextIndex,
IgnoreInputIndex, ObjectIndex, DataWritten);
return 0xc0000000; /* We don't have any. Whatever. (Yet.) */
}
/*
* Link objects
*/
/******************************************************************************
* NtOpenSymbolicLinkObject [NTDLL]
*/
NTSTATUS WINAPI NtOpenSymbolicLinkObject(
OUT PHANDLE LinkHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s)) stub\n",
LinkHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
}
/******************************************************************************
* NtCreateSymbolicLinkObject [NTDLL]
*/
NTSTATUS WINAPI NtCreateSymbolicLinkObject(
OUT PHANDLE SymbolicLinkHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN PUNICODE_STRING Name)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s), %p) stub\n",
SymbolicLinkHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
debugstr_w(Name->Buffer));
return 0;
}
/******************************************************************************
* NtQuerySymbolicLinkObject [NTDLL]
*/
NTSTATUS WINAPI NtQuerySymbolicLinkObject(
IN HANDLE LinkHandle,
IN OUT PUNICODE_STRING LinkTarget,
OUT PULONG ReturnedLength OPTIONAL)
{
FIXME(ntdll,"(0x%08x,%p,%p) stub\n",
LinkHandle, debugstr_w(LinkTarget->Buffer), ReturnedLength);
return 0;
}
#include "windef.h"
#include "wintypes.h"
/*
* registry functions
*/
#include "debug.h"
#include "winreg.h"
#include "ntdll.h"
#include "ntddk.h"
#include "debug.h"
/******************************************************************************
* NtCreateKey [NTDLL]
......
/*
* Rtl string functions
*
* Copyright 1996-1998 Marcus Meissner
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <wctype.h>
#include "wine/winestring.h"
#include "heap.h"
#include "winnls.h"
#include "debug.h"
#include "ntddk.h"
/*
* STRING FUNCTIONS
*/
/**************************************************************************
* RtlAnsiStringToUnicodeString [NTDLL.269]
*/
DWORD /* NTSTATUS */
WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOLEAN doalloc)
{
DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
if (unilen>0xFFFF)
return STATUS_INVALID_PARAMETER_2;
uni->Length = unilen;
if (doalloc) {
uni->MaximumLength = unilen;
uni->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,unilen);
if (!uni->Buffer)
return STATUS_NO_MEMORY;
}
if (unilen>uni->MaximumLength)
return STATUS_BUFFER_OVERFLOW;
lstrcpynAtoW(uni->Buffer,ansi->Buffer,unilen/2);
return STATUS_SUCCESS;
}
/**************************************************************************
* RtlOemStringToUnicodeString [NTDLL.447]
*/
DWORD /* NTSTATUS */
WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOLEAN doalloc)
{
DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
if (unilen>0xFFFF)
return STATUS_INVALID_PARAMETER_2;
uni->Length = unilen;
if (doalloc) {
uni->MaximumLength = unilen;
uni->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,unilen);
if (!uni->Buffer)
return STATUS_NO_MEMORY;
}
if (unilen>uni->MaximumLength)
return STATUS_BUFFER_OVERFLOW;
lstrcpynAtoW(uni->Buffer,ansi->Buffer,unilen/2);
return STATUS_SUCCESS;
}
/**************************************************************************
* RtlMultiByteToUnicodeN [NTDLL.436]
* FIXME: multibyte support
*/
DWORD /* NTSTATUS */
WINAPI RtlMultiByteToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen)
{
DWORD len;
LPWSTR x;
len = oemlen;
if (unilen/2 < len)
len = unilen/2;
x=(LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(len+1)*sizeof(WCHAR));
lstrcpynAtoW(x,oemstr,len+1);
memcpy(unistr,x,len*2);
if (reslen) *reslen = len*2;
return 0;
}
/**************************************************************************
* RtlOemToUnicodeN [NTDLL.448]
*/
DWORD /* NTSTATUS */
WINAPI RtlOemToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen)
{
DWORD len;
LPWSTR x;
len = oemlen;
if (unilen/2 < len)
len = unilen/2;
x=(LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(len+1)*sizeof(WCHAR));
lstrcpynAtoW(x,oemstr,len+1);
memcpy(unistr,x,len*2);
if (reslen) *reslen = len*2;
return 0;
}
/**************************************************************************
* RtlInitAnsiString [NTDLL.399]
*/
VOID WINAPI RtlInitAnsiString(PANSI_STRING target,LPCSTR source)
{
target->Length = target->MaximumLength = 0;
target->Buffer = (LPSTR)source;
if (!source)
return;
target->MaximumLength = lstrlenA(target->Buffer);
target->Length = target->MaximumLength+1;
}
/**************************************************************************
* RtlInitString [NTDLL.402]
*/
VOID WINAPI RtlInitString(PSTRING target,LPCSTR source)
{
target->Length = target->MaximumLength = 0;
target->Buffer = (LPSTR)source;
if (!source)
return;
target->MaximumLength = lstrlenA(target->Buffer);
target->Length = target->MaximumLength+1;
}
/**************************************************************************
* RtlInitUnicodeString [NTDLL.403]
*/
VOID WINAPI RtlInitUnicodeString(PUNICODE_STRING target,LPCWSTR source)
{
target->Length = target->MaximumLength = 0;
target->Buffer = (LPWSTR)source;
if (!source)
return;
target->MaximumLength = lstrlenW(target->Buffer)*2;
target->Length = target->MaximumLength+2;
}
/**************************************************************************
* RtlFreeUnicodeString [NTDLL.377]
*/
VOID WINAPI RtlFreeUnicodeString(PUNICODE_STRING str)
{
if (str->Buffer)
HeapFree(GetProcessHeap(),0,str->Buffer);
}
/**************************************************************************
* RtlFreeAnsiString [NTDLL.373]
*/
VOID WINAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
{
if( AnsiString->Buffer )
HeapFree( GetProcessHeap(),0,AnsiString->Buffer );
}
/**************************************************************************
* RtlUnicodeToOemN [NTDLL.515]
*/
DWORD /* NTSTATUS */
WINAPI RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,DWORD unilen)
{
DWORD len;
LPSTR x;
len = oemlen;
if (unilen/2 < len)
len = unilen/2;
x=(LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len+1);
lstrcpynWtoA(x,unistr,len+1);
memcpy(oemstr,x,len);
if (reslen) *reslen = len;
return 0;
}
/**************************************************************************
* RtlUnicodeStringToOemString [NTDLL.511]
*/
DWORD /* NTSTATUS */
WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc)
{
if (alloc) {
oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
oem->MaximumLength = uni->Length/2+1;
}
oem->Length = uni->Length/2;
lstrcpynWtoA(oem->Buffer,uni->Buffer,uni->Length/2+1);
return 0;
}
/**************************************************************************
* RtlUnicodeStringToAnsiString [NTDLL.507]
*/
DWORD /* NTSTATUS */
WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc)
{
if (alloc) {
oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
oem->MaximumLength = uni->Length/2+1;
}
oem->Length = uni->Length/2;
lstrcpynWtoA(oem->Buffer,uni->Buffer,uni->Length/2+1);
return 0;
}
/**************************************************************************
* RtlEqualUnicodeString [NTDLL]
*/
DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x) {
FIXME(ntdll,"(%s,%s,%ld),stub!\n",debugstr_w(s1->Buffer),debugstr_w(s2->Buffer),x);
return 0;
if (s1->Length != s2->Length)
return 1;
return !lstrncmpW(s1->Buffer,s2->Buffer,s1->Length/2);
}
/**************************************************************************
* RtlUpcaseUnicodeString [NTDLL.520]
*/
DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOLEAN doalloc)
{
LPWSTR s,t;
DWORD i,len;
len = src->Length;
if (doalloc) {
dest->MaximumLength = len;
dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len);
if (!dest->Buffer)
return STATUS_NO_MEMORY;
}
if (dest->MaximumLength < len)
return STATUS_BUFFER_OVERFLOW;
s=dest->Buffer;t=src->Buffer;
/* len is in bytes */
for (i=0;i<len/2;i++)
s[i] = towupper(t[i]);
return STATUS_SUCCESS;
}
/**************************************************************************
* RtlxOemStringToUnicodeSize [NTDLL.549]
*/
UINT WINAPI RtlxOemStringToUnicodeSize(PSTRING str)
{
return str->Length*2+2;
}
/**************************************************************************
* RtlxAnsiStringToUnicodeSize [NTDLL.548]
*/
UINT WINAPI RtlxAnsiStringToUnicodeSize(PANSI_STRING str)
{
return str->Length*2+2;
}
/**************************************************************************
* RtlIsTextUnicode [NTDLL.417]
*
* Apply various feeble heuristics to guess whether
* the text buffer contains Unicode.
* FIXME: should implement more tests.
*/
DWORD WINAPI RtlIsTextUnicode(LPVOID buf, DWORD len, DWORD *pf)
{
LPWSTR s = buf;
DWORD flags = -1, out_flags = 0;
if (!len)
goto out;
if (pf)
flags = *pf;
/*
* Apply various tests to the text string. According to the
* docs, each test "passed" sets the corresponding flag in
* the output flags. But some of the tests are mutually
* exclusive, so I don't see how you could pass all tests ...
*/
/* Check for an odd length ... pass if even. */
if (!(len & 1))
out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
/* Check for the special unicode marker byte. */
if (*s == 0xFEFF)
out_flags |= IS_TEXT_UNICODE_SIGNATURE;
/*
* Check whether the string passed all of the tests.
*/
flags &= ITU_IMPLEMENTED_TESTS;
if ((out_flags & flags) != flags)
len = 0;
out:
if (pf)
*pf = out_flags;
return len;
}
/******************************************************************************
* RtlCompareUnicodeString [NTDLL]
*/
NTSTATUS WINAPI RtlCompareUnicodeString(
PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
{
FIXME(ntdll,"(%s,%s,0x%08x),stub!\n",debugstr_w(String1->Buffer),debugstr_w(String1->Buffer),CaseInSensitive);
return 0;
}
/*
* Process synchronisation
*/
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "debugstr.h"
#include "debug.h"
#include "ntddk.h"
/*
* Semaphore
*/
/******************************************************************************
* NtCreateSemaphore [NTDLL]
*/
NTSTATUS WINAPI NtCreateSemaphore(
OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount,
IN ULONG MaximumCount)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s),0x%08lx,0x%08lx) stub!\n",
SemaphoreHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
InitialCount, MaximumCount);
return 0;
}
/******************************************************************************
* NtOpenSemaphore [NTDLL]
*/
NTSTATUS WINAPI NtOpenSemaphore(
IN HANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAcces,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME(ntdll,"(0x%08x,0x%08lx,%p(%s)) stub!\n",
SemaphoreHandle, DesiredAcces, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
}
/******************************************************************************
* NtQuerySemaphore [NTDLL]
*/
NTSTATUS WINAPI NtQuerySemaphore(
HANDLE SemaphoreHandle,
PVOID SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
ULONG Length,
PULONG ReturnLength)
{
FIXME(ntdll,"(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
SemaphoreHandle, SemaphoreInformationClass, SemaphoreInformation, Length, ReturnLength);
return 0;
}
/******************************************************************************
* NtReleaseSemaphore [NTDLL]
*/
NTSTATUS WINAPI NtReleaseSemaphore(
IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount,
IN PULONG PreviousCount)
{
FIXME(ntdll,"(0x%08x,0x%08lx,%p,) stub!\n",
SemaphoreHandle, ReleaseCount, PreviousCount);
return 0;
}
/*
* Event
*/
/**************************************************************************
* NtCreateEvent [NTDLL.71]
*/
NTSTATUS WINAPI NtCreateEvent(
OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN BOOLEAN ManualReset,
IN BOOLEAN InitialState)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s),%08x,%08x): empty stub\n",
EventHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
ManualReset,InitialState);
return 0;
}
/******************************************************************************
* NtOpenEvent [NTDLL]
*/
NTSTATUS WINAPI NtOpenEvent(
OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n",
EventHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
}
/******************************************************************************
* NtSetEvent [NTDLL]
*/
NTSTATUS WINAPI NtSetEvent(
IN HANDLE EventHandle,
PULONG NumberOfThreadsReleased)
{
FIXME(ntdll,"(0x%08x,%p)\n",
EventHandle, NumberOfThreadsReleased);
return 0;
}
/*
* Conversion between Time and TimeFields
*
* RtlTimeToTimeFields, RtlTimeFieldsToTime and defines are taken from ReactOS and
* adapted to wine with special permissions of the author
* Rex Jolliff (rex@lvcablemodem.com)
*
*
*/
#include <ntddk.h>
#include <debug.h>
#include <file.h>
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
#define SECSPERDAY 86400
#define SECSPERHOUR 3600
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define HOURSPERDAY 24
#define EPOCHWEEKDAY 0
#define DAYSPERWEEK 7
#define EPOCHYEAR 1601
#define DAYSPERNORMALYEAR 365
#define DAYSPERLEAPYEAR 366
#define MONSPERYEAR 12
static const int YearLengths[2] = {DAYSPERNORMALYEAR, DAYSPERLEAPYEAR};
static const int MonthLengths[2][MONSPERYEAR] =
{
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
static __inline int IsLeapYear(int Year)
{
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
}
static __inline void NormalizeTimeFields(CSHORT *FieldToNormalize, CSHORT *CarryField,int Modulus)
{
*FieldToNormalize = (CSHORT) (*FieldToNormalize - Modulus);
*CarryField = (CSHORT) (*CarryField + 1);
}
/******************************************************************************
* RtlTimeToTimeFields [NTDLL.265]
*
*/
VOID WINAPI RtlTimeToTimeFields(
PLARGE_INTEGER liTime,
PTIME_FIELDS TimeFields)
{
const int *Months;
int LeapSecondCorrections, SecondsInDay, CurYear;
int LeapYear, CurMonth, GMTOffset;
long int Days;
long long int Time = *(long long int *)&liTime;
/* Extract millisecond from time and convert time into seconds */
TimeFields->Milliseconds = (CSHORT) ((Time % TICKSPERSEC) / TICKSPERMSEC);
Time = Time / TICKSPERSEC;
/* FIXME: Compute the number of leap second corrections here */
LeapSecondCorrections = 0;
/* FIXME: get the GMT offset here */
GMTOffset = 0;
/* Split the time into days and seconds within the day */
Days = Time / SECSPERDAY;
SecondsInDay = Time % SECSPERDAY;
/* Adjust the values for GMT and leap seconds */
SecondsInDay += (GMTOffset - LeapSecondCorrections);
while (SecondsInDay < 0)
{ SecondsInDay += SECSPERDAY;
Days--;
}
while (SecondsInDay >= SECSPERDAY)
{ SecondsInDay -= SECSPERDAY;
Days++;
}
/* compute time of day */
TimeFields->Hour = (CSHORT) (SecondsInDay / SECSPERHOUR);
SecondsInDay = SecondsInDay % SECSPERHOUR;
TimeFields->Minute = (CSHORT) (SecondsInDay / SECSPERMIN);
TimeFields->Second = (CSHORT) (SecondsInDay % SECSPERMIN);
/* FIXME: handle the possibility that we are on a leap second (i.e. Second = 60) */
/* compute day of week */
TimeFields->Weekday = (CSHORT) ((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
/* compute year */
CurYear = EPOCHYEAR;
/* FIXME: handle calendar modifications */
while (1)
{ LeapYear = IsLeapYear(CurYear);
if (Days < (long) YearLengths[LeapYear])
{ break;
}
CurYear++;
Days = Days - (long) YearLengths[LeapYear];
}
TimeFields->Year = (CSHORT) CurYear;
/* Compute month of year */
Months = MonthLengths[LeapYear];
for (CurMonth = 0; Days >= (long) Months[CurMonth]; CurMonth++)
Days = Days - (long) Months[CurMonth];
TimeFields->Month = (CSHORT) (CurMonth + 1);
TimeFields->Day = (CSHORT) (Days + 1);
}
/******************************************************************************
* RtlTimeFieldsToTime [NTDLL.265]
*
*/
BOOLEAN WINAPI RtlTimeFieldsToTime(
PTIME_FIELDS tfTimeFields,
PLARGE_INTEGER Time)
{
int CurYear, CurMonth;
long long int rcTime;
TIME_FIELDS TimeFields = *tfTimeFields;
rcTime = 0;
/* FIXME: normalize the TIME_FIELDS structure here */
while (TimeFields.Second >= SECSPERMIN)
{ NormalizeTimeFields(&TimeFields.Second, &TimeFields.Minute, SECSPERMIN);
}
while (TimeFields.Minute >= MINSPERHOUR)
{ NormalizeTimeFields(&TimeFields.Minute, &TimeFields.Hour, MINSPERHOUR);
}
while (TimeFields.Hour >= HOURSPERDAY)
{ NormalizeTimeFields(&TimeFields.Hour, &TimeFields.Day, HOURSPERDAY);
}
while (TimeFields.Day > MonthLengths[IsLeapYear(TimeFields.Year)][TimeFields.Month - 1])
{ NormalizeTimeFields(&TimeFields.Day, &TimeFields.Month, SECSPERMIN);
}
while (TimeFields.Month > MONSPERYEAR)
{ NormalizeTimeFields(&TimeFields.Month, &TimeFields.Year, MONSPERYEAR);
}
/* FIXME: handle calendar corrections here */
for (CurYear = EPOCHYEAR; CurYear < TimeFields.Year; CurYear++)
{ rcTime += YearLengths[IsLeapYear(CurYear)];
}
for (CurMonth = 1; CurMonth < TimeFields.Month; CurMonth++)
{ rcTime += MonthLengths[IsLeapYear(CurYear)][CurMonth - 1];
}
rcTime += TimeFields.Day - 1;
rcTime *= SECSPERDAY;
rcTime += TimeFields.Hour * SECSPERHOUR + TimeFields.Minute * SECSPERMIN + TimeFields.Second;
rcTime *= TICKSPERSEC;
rcTime += TimeFields.Milliseconds * TICKSPERMSEC;
*Time = *(LARGE_INTEGER *)&rcTime;
return TRUE;
}
/************* end of code by Rex Jolliff (rex@lvcablemodem.com) *******************/
/******************************************************************************
* RtlSystemTimeToLocalTime [NTDLL]
*/
VOID WINAPI RtlSystemTimeToLocalTime(
IN PLARGE_INTEGER SystemTime,
OUT PLARGE_INTEGER LocalTime)
{
FIXME(ntdll,"(%p, %p),stub!\n",SystemTime,LocalTime);
memcpy (LocalTime, SystemTime, sizeof (PLARGE_INTEGER));
}
/******************************************************************************
* RtlToTimeInSecondsSince1980 [NTDLL]
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1980(
LPFILETIME ft,
LPDWORD timeret)
{
/* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */
*timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600;
return 1;
}
/******************************************************************************
* RtlToTimeInSecondsSince1970 [NTDLL]
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1970(
LPFILETIME ft,
LPDWORD timeret)
{
*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
return 1;
}
/******************************************************************************
* RtlTimeToElapsedTimeFields [NTDLL.502]
* FIXME: prototype guessed
*/
VOID WINAPI RtlTimeToElapsedTimeFields(
PLARGE_INTEGER liTime,
PTIME_FIELDS TimeFields)
{
FIXME(ntdll,"(%p,%p): stub\n",liTime,TimeFields);
}
......@@ -96,7 +96,7 @@ type win32
0092 stdcall GetSecurityDescriptorGroup(ptr ptr ptr) GetSecurityDescriptorGroup
0093 stdcall GetSecurityDescriptorLength(ptr) GetSecurityDescriptorLength
0094 stdcall GetSecurityDescriptorOwner(ptr ptr ptr) GetSecurityDescriptorOwner
0095 stub GetSecurityDescriptorSacl
0095 stdcall GetSecurityDescriptorSacl (ptr ptr ptr ptr) GetSecurityDescriptorSacl
0096 stub GetServiceDisplayNameA
0097 stub GetServiceDisplayNameW
0098 stub GetServiceKeyNameA
......
......@@ -153,7 +153,7 @@ type win32
145 stub NtPulseEvent
146 stub NtQueryAttributesFile
147 stub NtQueryDefaultLocale
148 stub NtQueryDirectoryFile
148 stdcall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)NtQueryDirectoryFile
149 stdcall NtQueryDirectoryObject(long long long long long long long) NtQueryDirectoryObject
150 stub NtQueryEaFile
151 stub NtQueryEvent
......@@ -271,7 +271,7 @@ type win32
263 stub RtlAddAuditAccessAce
264 stdcall RtlAdjustPrivilege(long long long long) RtlAdjustPrivilege
265 stdcall RtlAllocateAndInitializeSid (ptr long long long long long long long long long ptr) RtlAllocateAndInitializeSid
266 stdcall RtlAllocateHeap(long long long) HeapAlloc
266 stdcall RtlAllocateHeap(long long long) RtlAllocateHeap
267 stub RtlAnsiCharToUnicodeChar
268 stub RtlAnsiStringToUnicodeSize
269 stdcall RtlAnsiStringToUnicodeString(ptr ptr long) RtlAnsiStringToUnicodeString
......@@ -314,7 +314,7 @@ type win32
306 stdcall RtlCreateAcl(ptr long long) RtlCreateAcl
307 stub RtlCreateAndSetSD
308 stdcall RtlCreateEnvironment(long long) RtlCreateEnvironment
309 stdcall RtlCreateHeap(long long long) HeapCreate
309 stdcall RtlCreateHeap(long ptr long long ptr) RtlCreateHeap
310 stub RtlCreateProcessParameters
311 stub RtlCreateQueryDebugBuffer
312 stub RtlCreateRegistryKey
......@@ -338,7 +338,7 @@ type win32
330 stdcall RtlDeleteResource(ptr) RtlDeleteResource
331 stdcall RtlDeleteSecurityObject(long) RtlDeleteSecurityObject
332 stdcall RtlDestroyEnvironment(long) RtlDestroyEnvironment
333 stdcall RtlDestroyHeap(long) HeapDestroy
333 stdcall RtlDestroyHeap(long) RtlDestroyHeap
334 stub RtlDestroyProcessParameters
335 stub RtlDestroyQueryDebugBuffer
336 stub RtlDetermineDosPathNameType_U
......@@ -379,7 +379,7 @@ type win32
371 stdcall RtlFormatCurrentUserKeyPath() RtlFormatCurrentUserKeyPath
372 stub RtlFormatMessage
373 stdcall RtlFreeAnsiString(long) RtlFreeAnsiString
374 stdcall RtlFreeHeap(long long long) HeapFree
374 stdcall RtlFreeHeap(long long long) RtlFreeHeap
375 stub RtlFreeOemString
376 stdcall RtlFreeSid (long) RtlFreeSid
377 stdcall RtlFreeUnicodeString(ptr) RtlFreeUnicodeString
......@@ -389,7 +389,7 @@ type win32
381 stub RtlGetCompressionWorkSpaceSize
382 stub RtlGetControlSecurityDescriptor
383 stub RtlGetCurrentDirectory_U
384 stdcall RtlGetDaclSecurityDescriptor(long long long long) RtlGetDaclSecurityDescriptor
384 stdcall RtlGetDaclSecurityDescriptor(ptr ptr ptr ptr) RtlGetDaclSecurityDescriptor
385 stub RtlGetElementGenericTable
386 stub RtlGetFullPathName_U
387 stub RtlGetGroupSecurityDescriptor
......@@ -398,7 +398,7 @@ type win32
390 stdcall RtlGetNtProductType(ptr) RtlGetNtProductType
391 stub RtlGetOwnerSecurityDescriptor
392 stub RtlGetProcessHeaps
393 stub RtlGetSaclSecurityDescriptor
393 stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr)RtlGetSaclSecurityDescriptor
394 stub RtlGetUserInfoHeap
395 stub RtlIdentifierAuthoritySid
396 stub RtlImageDirectoryEntryToData
......@@ -654,7 +654,7 @@ type win32
646 stub ZwPulseEvent
647 stub ZwQueryAttributesFile
648 stub ZwQueryDefaultLocale
649 stub ZwQueryDirectoryFile
649 stdcall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)NtQueryDirectoryFile
650 stdcall ZwQueryDirectoryObject(long long long long long long long) NtQueryDirectoryObject
651 stub ZwQueryEaFile
652 stub ZwQueryEvent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment