2 * ntoskrnl.exe implementation
4 * Copyright (C) 2007 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
30 #define WIN32_NO_STATUS
35 #include "wine/unicode.h"
36 #include "wine/server.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl
);
40 WINE_DECLARE_DEBUG_CHANNEL(relay
);
43 KSYSTEM_TIME KeTickCount
= { 0, 0, 0 };
45 typedef struct _KSERVICE_TABLE_DESCRIPTOR
51 } KSERVICE_TABLE_DESCRIPTOR
, *PKSERVICE_TABLE_DESCRIPTOR
;
53 KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable
[4] = { { 0 } };
55 typedef void (WINAPI
*PCREATE_PROCESS_NOTIFY_ROUTINE
)(HANDLE
,HANDLE
,BOOLEAN
);
58 #define DEFINE_FASTCALL1_ENTRYPOINT( name ) \
59 __ASM_GLOBAL_FUNC( name, \
63 "jmp " __ASM_NAME("__regs_") #name )
64 #define DEFINE_FASTCALL2_ENTRYPOINT( name ) \
65 __ASM_GLOBAL_FUNC( name, \
70 "jmp " __ASM_NAME("__regs_") #name )
73 static inline LPCSTR
debugstr_us( const UNICODE_STRING
*us
)
75 if (!us
) return "<null>";
76 return debugstr_wn( us
->Buffer
, us
->Length
/ sizeof(WCHAR
) );
79 static HANDLE
get_device_manager(void)
81 static HANDLE device_manager
;
82 HANDLE handle
= 0, ret
= device_manager
;
86 SERVER_START_REQ( create_device_manager
)
88 req
->access
= SYNCHRONIZE
;
90 if (!wine_server_call( req
)) handle
= reply
->handle
;
96 ERR( "failed to create the device manager\n" );
99 if (!(ret
= InterlockedCompareExchangePointer( &device_manager
, handle
, 0 )))
102 NtClose( handle
); /* somebody beat us to it */
107 /* exception handler for emulation of privileged instructions */
108 static LONG CALLBACK
vectored_handler( EXCEPTION_POINTERS
*ptrs
)
110 extern DWORD
__wine_emulate_instruction( EXCEPTION_RECORD
*rec
, CONTEXT86
*context
);
112 EXCEPTION_RECORD
*record
= ptrs
->ExceptionRecord
;
113 CONTEXT86
*context
= ptrs
->ContextRecord
;
115 if (record
->ExceptionCode
== EXCEPTION_ACCESS_VIOLATION
||
116 record
->ExceptionCode
== EXCEPTION_PRIV_INSTRUCTION
)
118 if (__wine_emulate_instruction( record
, context
) == ExceptionContinueExecution
)
119 return EXCEPTION_CONTINUE_EXECUTION
;
121 return EXCEPTION_CONTINUE_SEARCH
;
124 /* process an ioctl request for a given device */
125 static NTSTATUS
process_ioctl( DEVICE_OBJECT
*device
, ULONG code
, void *in_buff
, ULONG in_size
,
126 void *out_buff
, ULONG
*out_size
)
130 IO_STACK_LOCATION irpsp
;
131 PDRIVER_DISPATCH dispatch
= device
->DriverObject
->MajorFunction
[IRP_MJ_DEVICE_CONTROL
];
135 TRACE( "ioctl %x device %p in_size %u out_size %u\n", code
, device
, in_size
, *out_size
);
137 /* so we can spot things that we should initialize */
138 memset( &irp
, 0x55, sizeof(irp
) );
139 memset( &irpsp
, 0x66, sizeof(irpsp
) );
140 memset( &mdl
, 0x77, sizeof(mdl
) );
142 irp
.RequestorMode
= UserMode
;
143 irp
.AssociatedIrp
.SystemBuffer
= in_buff
;
144 irp
.UserBuffer
= out_buff
;
145 irp
.MdlAddress
= &mdl
;
146 irp
.Tail
.Overlay
.s
.u
.CurrentStackLocation
= &irpsp
;
148 irpsp
.MajorFunction
= IRP_MJ_DEVICE_CONTROL
;
149 irpsp
.Parameters
.DeviceIoControl
.OutputBufferLength
= *out_size
;
150 irpsp
.Parameters
.DeviceIoControl
.InputBufferLength
= in_size
;
151 irpsp
.Parameters
.DeviceIoControl
.IoControlCode
= code
;
152 irpsp
.Parameters
.DeviceIoControl
.Type3InputBuffer
= in_buff
;
153 irpsp
.DeviceObject
= device
;
157 mdl
.StartVa
= out_buff
;
158 mdl
.ByteCount
= *out_size
;
161 device
->CurrentIrp
= &irp
;
163 KeQueryTickCount( &count
); /* update the global KeTickCount */
166 DPRINTF( "%04x:Call driver dispatch %p (device=%p,irp=%p)\n",
167 GetCurrentThreadId(), dispatch
, device
, &irp
);
169 status
= dispatch( device
, &irp
);
172 DPRINTF( "%04x:Ret driver dispatch %p (device=%p,irp=%p) retval=%08x\n",
173 GetCurrentThreadId(), dispatch
, device
, &irp
, status
);
175 *out_size
= (irp
.IoStatus
.u
.Status
>= 0) ? irp
.IoStatus
.Information
: 0;
176 return irp
.IoStatus
.u
.Status
;
180 /***********************************************************************
181 * wine_ntoskrnl_main_loop (Not a Windows API)
183 NTSTATUS
wine_ntoskrnl_main_loop( HANDLE stop_event
)
185 HANDLE manager
= get_device_manager();
187 NTSTATUS status
= STATUS_SUCCESS
;
189 void *in_buff
, *out_buff
= NULL
;
190 DEVICE_OBJECT
*device
= NULL
;
191 ULONG in_size
= 4096, out_size
= 0;
194 if (!(in_buff
= HeapAlloc( GetProcessHeap(), 0, in_size
)))
196 ERR( "failed to allocate buffer\n" );
197 return STATUS_NO_MEMORY
;
200 handles
[0] = stop_event
;
201 handles
[1] = manager
;
205 SERVER_START_REQ( get_next_device_request
)
207 req
->manager
= manager
;
209 req
->status
= status
;
210 wine_server_add_data( req
, out_buff
, out_size
);
211 wine_server_set_reply( req
, in_buff
, in_size
);
212 if (!(status
= wine_server_call( req
)))
216 device
= reply
->user_ptr
;
217 in_size
= reply
->in_size
;
218 out_size
= reply
->out_size
;
222 ioctl
= 0; /* no previous ioctl */
224 in_size
= reply
->in_size
;
232 HeapFree( GetProcessHeap(), 0, out_buff
);
233 if (out_size
) out_buff
= HeapAlloc( GetProcessHeap(), 0, out_size
);
234 else out_buff
= NULL
;
235 status
= process_ioctl( device
, code
, in_buff
, in_size
, out_buff
, &out_size
);
237 case STATUS_BUFFER_OVERFLOW
:
238 HeapFree( GetProcessHeap(), 0, in_buff
);
239 in_buff
= HeapAlloc( GetProcessHeap(), 0, in_size
);
240 /* restart with larger buffer */
243 if (WaitForMultipleObjects( 2, handles
, FALSE
, INFINITE
) == WAIT_OBJECT_0
)
244 return STATUS_SUCCESS
;
250 /***********************************************************************
251 * IoAllocateMdl (NTOSKRNL.EXE.@)
253 PMDL WINAPI
IoAllocateMdl( PVOID VirtualAddress
, ULONG Length
, BOOLEAN SecondaryBuffer
, BOOLEAN ChargeQuota
, PIRP Irp
)
255 FIXME( "stub: %p, %u, %i, %i, %p\n", VirtualAddress
, Length
, SecondaryBuffer
, ChargeQuota
, Irp
);
260 /***********************************************************************
261 * IoAllocateWorkItem (NTOSKRNL.EXE.@)
263 PIO_WORKITEM WINAPI
IoAllocateWorkItem( PDEVICE_OBJECT DeviceObject
)
265 FIXME( "stub: %p\n", DeviceObject
);
270 /***********************************************************************
271 * IoCreateDriver (NTOSKRNL.EXE.@)
273 NTSTATUS WINAPI
IoCreateDriver( UNICODE_STRING
*name
, PDRIVER_INITIALIZE init
)
275 DRIVER_OBJECT
*driver
;
276 DRIVER_EXTENSION
*extension
;
279 if (!(driver
= RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY
,
280 sizeof(*driver
) + sizeof(*extension
) )))
281 return STATUS_NO_MEMORY
;
283 if ((status
= RtlDuplicateUnicodeString( 1, name
, &driver
->DriverName
)))
285 RtlFreeHeap( GetProcessHeap(), 0, driver
);
289 extension
= (DRIVER_EXTENSION
*)(driver
+ 1);
290 driver
->Size
= sizeof(*driver
);
291 driver
->DriverInit
= init
;
292 driver
->DriverExtension
= extension
;
293 extension
->DriverObject
= driver
;
294 extension
->ServiceKeyName
= driver
->DriverName
;
296 status
= driver
->DriverInit( driver
, name
);
300 RtlFreeUnicodeString( &driver
->DriverName
);
301 RtlFreeHeap( GetProcessHeap(), 0, driver
);
307 /***********************************************************************
308 * IoDeleteDriver (NTOSKRNL.EXE.@)
310 void WINAPI
IoDeleteDriver( DRIVER_OBJECT
*driver
)
312 RtlFreeUnicodeString( &driver
->DriverName
);
313 RtlFreeHeap( GetProcessHeap(), 0, driver
);
317 /***********************************************************************
318 * IoCreateDevice (NTOSKRNL.EXE.@)
320 NTSTATUS WINAPI
IoCreateDevice( DRIVER_OBJECT
*driver
, ULONG ext_size
,
321 UNICODE_STRING
*name
, DEVICE_TYPE type
,
322 ULONG characteristics
, BOOLEAN exclusive
,
323 DEVICE_OBJECT
**ret_device
)
326 DEVICE_OBJECT
*device
;
328 HANDLE manager
= get_device_manager();
330 TRACE( "(%p, %u, %s, %u, %x, %u, %p)\n",
331 driver
, ext_size
, debugstr_us(name
), type
, characteristics
, exclusive
, ret_device
);
333 if (!(device
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*device
) + ext_size
)))
334 return STATUS_NO_MEMORY
;
336 SERVER_START_REQ( create_device
)
341 req
->manager
= manager
;
342 req
->user_ptr
= device
;
343 if (name
) wine_server_add_data( req
, name
->Buffer
, name
->Length
);
344 if (!(status
= wine_server_call( req
))) handle
= reply
->handle
;
348 if (status
== STATUS_SUCCESS
)
350 device
->DriverObject
= driver
;
351 device
->DeviceExtension
= device
+ 1;
352 device
->DeviceType
= type
;
353 device
->Reserved
= handle
;
355 device
->NextDevice
= driver
->DeviceObject
;
356 driver
->DeviceObject
= device
;
358 *ret_device
= device
;
360 else HeapFree( GetProcessHeap(), 0, device
);
366 /***********************************************************************
367 * IoDeleteDevice (NTOSKRNL.EXE.@)
369 void WINAPI
IoDeleteDevice( DEVICE_OBJECT
*device
)
373 TRACE( "%p\n", device
);
375 SERVER_START_REQ( delete_device
)
377 req
->handle
= device
->Reserved
;
378 status
= wine_server_call( req
);
382 if (status
== STATUS_SUCCESS
)
384 DEVICE_OBJECT
**prev
= &device
->DriverObject
->DeviceObject
;
385 while (*prev
&& *prev
!= device
) prev
= &(*prev
)->NextDevice
;
386 if (*prev
) *prev
= (*prev
)->NextDevice
;
387 NtClose( device
->Reserved
);
388 HeapFree( GetProcessHeap(), 0, device
);
393 /***********************************************************************
394 * IoCreateSymbolicLink (NTOSKRNL.EXE.@)
396 NTSTATUS WINAPI
IoCreateSymbolicLink( UNICODE_STRING
*name
, UNICODE_STRING
*target
)
399 OBJECT_ATTRIBUTES attr
;
401 attr
.Length
= sizeof(attr
);
402 attr
.RootDirectory
= 0;
403 attr
.ObjectName
= name
;
404 attr
.Attributes
= OBJ_CASE_INSENSITIVE
| OBJ_OPENIF
;
405 attr
.SecurityDescriptor
= NULL
;
406 attr
.SecurityQualityOfService
= NULL
;
408 TRACE( "%s -> %s\n", debugstr_us(name
), debugstr_us(target
) );
409 /* FIXME: store handle somewhere */
410 return NtCreateSymbolicLinkObject( &handle
, SYMBOLIC_LINK_ALL_ACCESS
, &attr
, target
);
414 /***********************************************************************
415 * IofCompleteRequest (NTOSKRNL.EXE.@)
417 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
418 DEFINE_FASTCALL2_ENTRYPOINT( IofCompleteRequest
)
419 void WINAPI
__regs_IofCompleteRequest( IRP
*irp
, UCHAR priority_boost
)
421 void WINAPI
IofCompleteRequest( IRP
*irp
, UCHAR priority_boost
)
424 TRACE( "%p %u\n", irp
, priority_boost
);
425 /* nothing to do for now */
429 /***********************************************************************
430 * InterlockedCompareExchange (NTOSKRNL.EXE.@)
432 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
433 DEFINE_FASTCALL2_ENTRYPOINT( NTOSKRNL_InterlockedCompareExchange
)
434 LONG WINAPI
__regs_NTOSKRNL_InterlockedCompareExchange( LONG
volatile *dest
, LONG xchg
, LONG compare
)
436 LONG WINAPI
NTOSKRNL_InterlockedCompareExchange( LONG
volatile *dest
, LONG xchg
, LONG compare
)
439 return InterlockedCompareExchange( dest
, xchg
, compare
);
443 /***********************************************************************
444 * InterlockedDecrement (NTOSKRNL.EXE.@)
446 #ifdef DEFINE_FASTCALL1_ENTRYPOINT
447 DEFINE_FASTCALL1_ENTRYPOINT( NTOSKRNL_InterlockedDecrement
)
448 LONG WINAPI
__regs_NTOSKRNL_InterlockedDecrement( LONG
volatile *dest
)
450 LONG WINAPI
NTOSKRNL_InterlockedDecrement( LONG
volatile *dest
)
453 return InterlockedDecrement( dest
);
457 /***********************************************************************
458 * InterlockedExchange (NTOSKRNL.EXE.@)
460 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
461 DEFINE_FASTCALL2_ENTRYPOINT( NTOSKRNL_InterlockedExchange
)
462 LONG WINAPI
__regs_NTOSKRNL_InterlockedExchange( LONG
volatile *dest
, LONG val
)
464 LONG WINAPI
NTOSKRNL_InterlockedExchange( LONG
volatile *dest
, LONG val
)
467 return InterlockedExchange( dest
, val
);
471 /***********************************************************************
472 * InterlockedExchangeAdd (NTOSKRNL.EXE.@)
474 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
475 DEFINE_FASTCALL2_ENTRYPOINT( NTOSKRNL_InterlockedExchangeAdd
)
476 LONG WINAPI
__regs_NTOSKRNL_InterlockedExchangeAdd( LONG
volatile *dest
, LONG incr
)
478 LONG WINAPI
NTOSKRNL_InterlockedExchangeAdd( LONG
volatile *dest
, LONG incr
)
481 return InterlockedExchangeAdd( dest
, incr
);
485 /***********************************************************************
486 * InterlockedIncrement (NTOSKRNL.EXE.@)
488 #ifdef DEFINE_FASTCALL1_ENTRYPOINT
489 DEFINE_FASTCALL1_ENTRYPOINT( NTOSKRNL_InterlockedIncrement
)
490 LONG WINAPI
__regs_NTOSKRNL_InterlockedIncrement( LONG
volatile *dest
)
492 LONG WINAPI
NTOSKRNL_InterlockedIncrement( LONG
volatile *dest
)
495 return InterlockedIncrement( dest
);
499 /***********************************************************************
500 * ExAllocatePool (NTOSKRNL.EXE.@)
502 PVOID WINAPI
ExAllocatePool( POOL_TYPE type
, SIZE_T size
)
504 return ExAllocatePoolWithTag( type
, size
, 0 );
508 /***********************************************************************
509 * ExAllocatePoolWithQuota (NTOSKRNL.EXE.@)
511 PVOID WINAPI
ExAllocatePoolWithQuota( POOL_TYPE type
, SIZE_T size
)
513 return ExAllocatePoolWithTag( type
, size
, 0 );
517 /***********************************************************************
518 * ExAllocatePoolWithTag (NTOSKRNL.EXE.@)
520 PVOID WINAPI
ExAllocatePoolWithTag( POOL_TYPE type
, SIZE_T size
, ULONG tag
)
522 /* FIXME: handle page alignment constraints */
523 void *ret
= HeapAlloc( GetProcessHeap(), 0, size
);
524 TRACE( "%lu pool %u -> %p\n", size
, type
, ret
);
529 /***********************************************************************
530 * ExAllocatePoolWithQuotaTag (NTOSKRNL.EXE.@)
532 PVOID WINAPI
ExAllocatePoolWithQuotaTag( POOL_TYPE type
, SIZE_T size
, ULONG tag
)
534 return ExAllocatePoolWithTag( type
, size
, tag
);
538 /***********************************************************************
539 * ExFreePool (NTOSKRNL.EXE.@)
541 void WINAPI
ExFreePool( void *ptr
)
543 ExFreePoolWithTag( ptr
, 0 );
547 /***********************************************************************
548 * ExFreePoolWithTag (NTOSKRNL.EXE.@)
550 void WINAPI
ExFreePoolWithTag( void *ptr
, ULONG tag
)
552 TRACE( "%p\n", ptr
);
553 HeapFree( GetProcessHeap(), 0, ptr
);
557 /***********************************************************************
558 * KeInitializeSpinLock (NTOSKRNL.EXE.@)
560 void WINAPI
KeInitializeSpinLock( PKSPIN_LOCK SpinLock
)
562 FIXME("%p\n", SpinLock
);
566 /***********************************************************************
567 * KeInitializeTimerEx (NTOSKRNL.EXE.@)
569 void WINAPI
KeInitializeTimerEx( PKTIMER Timer
, TIMER_TYPE Type
)
571 FIXME("%p %d\n", Timer
, Type
);
575 /***********************************************************************
576 * KeInitializeTimer (NTOSKRNL.EXE.@)
578 void WINAPI
KeInitializeTimer( PKTIMER Timer
)
580 KeInitializeTimerEx(Timer
, NotificationTimer
);
584 /**********************************************************************
585 * KeQueryActiveProcessors (NTOSKRNL.EXE.@)
587 * Return the active Processors as bitmask
590 * active Processors as bitmask
593 KAFFINITY WINAPI
KeQueryActiveProcessors( void )
595 DWORD_PTR AffinityMask
;
597 GetProcessAffinityMask( GetCurrentProcess(), &AffinityMask
, NULL
);
602 /**********************************************************************
603 * KeQueryInterruptTime (NTOSKRNL.EXE.@)
605 * Return the interrupt time count
608 ULONGLONG WINAPI
KeQueryInterruptTime( void )
610 LARGE_INTEGER totaltime
;
612 KeQueryTickCount(&totaltime
);
613 return totaltime
.QuadPart
;
617 /***********************************************************************
618 * KeQuerySystemTime (NTOSKRNL.EXE.@)
620 void WINAPI
KeQuerySystemTime( LARGE_INTEGER
*time
)
622 NtQuerySystemTime( time
);
626 /***********************************************************************
627 * KeQueryTickCount (NTOSKRNL.EXE.@)
629 void WINAPI
KeQueryTickCount( LARGE_INTEGER
*count
)
631 count
->QuadPart
= NtGetTickCount();
632 /* update the global variable too */
633 KeTickCount
.LowPart
= count
->u
.LowPart
;
634 KeTickCount
.High1Time
= count
->u
.HighPart
;
635 KeTickCount
.High2Time
= count
->u
.HighPart
;
639 /***********************************************************************
640 * KeQueryTimeIncrement (NTOSKRNL.EXE.@)
642 ULONG WINAPI
KeQueryTimeIncrement(void)
648 /***********************************************************************
649 * MmAllocateNonCachedMemory (NTOSKRNL.EXE.@)
651 PVOID WINAPI
MmAllocateNonCachedMemory( SIZE_T size
)
653 TRACE( "%lu\n", size
);
654 return VirtualAlloc( NULL
, size
, MEM_RESERVE
|MEM_COMMIT
, PAGE_READWRITE
|PAGE_NOCACHE
);
658 /***********************************************************************
659 * MmFreeNonCachedMemory (NTOSKRNL.EXE.@)
661 void WINAPI
MmFreeNonCachedMemory( void *addr
, SIZE_T size
)
663 TRACE( "%p %lu\n", addr
, size
);
664 VirtualFree( addr
, 0, MEM_RELEASE
);
667 /***********************************************************************
668 * MmIsAddressValid (NTOSKRNL.EXE.@)
670 * Check if the process can access the virtual address without a pagefault
673 * VirtualAddress [I] Address to check
677 * Success: TRUE (Accessing the Address works without a Pagefault)
680 BOOLEAN WINAPI
MmIsAddressValid(PVOID VirtualAddress
)
682 TRACE("(%p)\n", VirtualAddress
);
683 return !IsBadWritePtr(VirtualAddress
, 1);
686 /***********************************************************************
687 * MmPageEntireDriver (NTOSKRNL.EXE.@)
689 PVOID WINAPI
MmPageEntireDriver(PVOID AddrInSection
)
691 TRACE("%p\n", AddrInSection
);
692 return AddrInSection
;
695 /***********************************************************************
696 * MmResetDriverPaging (NTOSKRNL.EXE.@)
698 void WINAPI
MmResetDriverPaging(PVOID AddrInSection
)
700 TRACE("%p\n", AddrInSection
);
703 /***********************************************************************
704 * PsCreateSystemThread (NTOSKRNL.EXE.@)
706 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE ThreadHandle
, ULONG DesiredAccess
,
707 POBJECT_ATTRIBUTES ObjectAttributes
,
708 HANDLE ProcessHandle
, PCLIENT_ID ClientId
,
709 PKSTART_ROUTINE StartRoutine
, PVOID StartContext
)
711 if (!ProcessHandle
) ProcessHandle
= GetCurrentProcess();
712 return RtlCreateUserThread(ProcessHandle
, 0, FALSE
, 0, 0,
713 0, StartRoutine
, StartContext
,
714 ThreadHandle
, ClientId
);
717 /***********************************************************************
718 * PsGetCurrentProcessId (NTOSKRNL.EXE.@)
720 HANDLE WINAPI
PsGetCurrentProcessId(void)
722 return (HANDLE
)GetCurrentProcessId(); /* FIXME: not quite right... */
726 /***********************************************************************
727 * PsGetCurrentThreadId (NTOSKRNL.EXE.@)
729 HANDLE WINAPI
PsGetCurrentThreadId(void)
731 return (HANDLE
)GetCurrentThreadId(); /* FIXME: not quite right... */
735 /***********************************************************************
736 * PsGetVersion (NTOSKRNL.EXE.@)
738 BOOLEAN WINAPI
PsGetVersion(ULONG
*major
, ULONG
*minor
, ULONG
*build
, UNICODE_STRING
*version
)
740 RTL_OSVERSIONINFOEXW info
;
742 RtlGetVersion( &info
);
743 if (major
) *major
= info
.dwMajorVersion
;
744 if (minor
) *minor
= info
.dwMinorVersion
;
745 if (build
) *build
= info
.dwBuildNumber
;
749 #if 0 /* FIXME: GameGuard passes an uninitialized pointer in version->Buffer */
750 size_t len
= min( strlenW(info
.szCSDVersion
)*sizeof(WCHAR
), version
->MaximumLength
);
751 memcpy( version
->Buffer
, info
.szCSDVersion
, len
);
752 if (len
< version
->MaximumLength
) version
->Buffer
[len
/ sizeof(WCHAR
)] = 0;
753 version
->Length
= len
;
760 /***********************************************************************
761 * PsSetCreateProcessNotifyRoutine (NTOSKRNL.EXE.@)
763 NTSTATUS WINAPI
PsSetCreateProcessNotifyRoutine( PCREATE_PROCESS_NOTIFY_ROUTINE callback
, BOOLEAN remove
)
765 FIXME( "stub: %p %d\n", callback
, remove
);
766 return STATUS_SUCCESS
;
770 /*****************************************************
773 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
779 case DLL_PROCESS_ATTACH
:
780 DisableThreadLibraryCalls( inst
);
781 RtlAddVectoredExceptionHandler( TRUE
, vectored_handler
);
782 KeQueryTickCount( &count
); /* initialize the global KeTickCount */