winebuild: Create stubs for ARM64.
[wine.git] / dlls / ntoskrnl.exe / ntoskrnl.c
blob2051939bfadad6132b638a39b366892d54cccce7
1 /*
2 * ntoskrnl.exe implementation
4 * Copyright (C) 2007 Alexandre Julliard
5 * Copyright (C) 2010 Damjan Jovanovic
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdarg.h>
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
30 #include "ntstatus.h"
31 #define WIN32_NO_STATUS
32 #include "windef.h"
33 #include "winternl.h"
34 #include "excpt.h"
35 #include "winioctl.h"
36 #include "ddk/csq.h"
37 #include "ddk/ntddk.h"
38 #include "ddk/ntifs.h"
39 #include "wine/unicode.h"
40 #include "wine/server.h"
41 #include "wine/list.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl);
45 WINE_DECLARE_DEBUG_CHANNEL(relay);
47 BOOLEAN KdDebuggerEnabled = FALSE;
48 ULONG InitSafeBootMode = 0;
50 extern LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs );
52 KSYSTEM_TIME KeTickCount = { 0, 0, 0 };
54 typedef struct _KSERVICE_TABLE_DESCRIPTOR
56 PULONG_PTR Base;
57 PULONG Count;
58 ULONG Limit;
59 PUCHAR Number;
60 } KSERVICE_TABLE_DESCRIPTOR, *PKSERVICE_TABLE_DESCRIPTOR;
62 KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[4] = { { 0 } };
64 typedef void (WINAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)(HANDLE,HANDLE,BOOLEAN);
65 typedef void (WINAPI *PCREATE_THREAD_NOTIFY_ROUTINE)(HANDLE,HANDLE,BOOLEAN);
67 /* tid of the thread running client request */
68 static DWORD request_thread;
70 /* pid/tid of the client thread */
71 static DWORD client_tid;
72 static DWORD client_pid;
74 #ifdef __i386__
75 #define DEFINE_FASTCALL1_ENTRYPOINT( name ) \
76 __ASM_STDCALL_FUNC( name, 4, \
77 "popl %eax\n\t" \
78 "pushl %ecx\n\t" \
79 "pushl %eax\n\t" \
80 "jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(4))
81 #define DEFINE_FASTCALL2_ENTRYPOINT( name ) \
82 __ASM_STDCALL_FUNC( name, 8, \
83 "popl %eax\n\t" \
84 "pushl %edx\n\t" \
85 "pushl %ecx\n\t" \
86 "pushl %eax\n\t" \
87 "jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(8))
88 #define DEFINE_FASTCALL3_ENTRYPOINT( name ) \
89 __ASM_STDCALL_FUNC( name, 12, \
90 "popl %eax\n\t" \
91 "pushl %edx\n\t" \
92 "pushl %ecx\n\t" \
93 "pushl %eax\n\t" \
94 "jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(12))
95 #endif
97 static inline LPCSTR debugstr_us( const UNICODE_STRING *us )
99 if (!us) return "<null>";
100 return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
103 static HANDLE get_device_manager(void)
105 static HANDLE device_manager;
106 HANDLE handle = 0, ret = device_manager;
108 if (!ret)
110 SERVER_START_REQ( create_device_manager )
112 req->access = SYNCHRONIZE;
113 req->attributes = 0;
114 if (!wine_server_call( req )) handle = wine_server_ptr_handle( reply->handle );
116 SERVER_END_REQ;
118 if (!handle)
120 ERR( "failed to create the device manager\n" );
121 return 0;
123 if (!(ret = InterlockedCompareExchangePointer( &device_manager, handle, 0 )))
124 ret = handle;
125 else
126 NtClose( handle ); /* somebody beat us to it */
128 return ret;
131 static NTSTATUS dispatch_irp( DEVICE_OBJECT *device, IRP *irp )
133 LARGE_INTEGER count;
134 FILE_OBJECT file;
136 irp->RequestorMode = UserMode;
137 irp->Tail.Overlay.OriginalFileObject = &file;
139 memset( &file, 0x88, sizeof(file) );
140 file.FsContext = NULL;
141 file.FsContext2 = NULL;
143 KeQueryTickCount( &count ); /* update the global KeTickCount */
145 device->CurrentIrp = irp;
147 IoCallDriver( device, irp );
149 device->CurrentIrp = NULL;
151 return STATUS_SUCCESS;
154 /* process a read request for a given device */
155 static NTSTATUS dispatch_read( DEVICE_OBJECT *device, const irp_params_t *params,
156 void *in_buff, ULONG in_size, ULONG out_size, HANDLE irp_handle )
158 IRP *irp;
159 void *out_buff;
160 LARGE_INTEGER offset;
161 IO_STACK_LOCATION *irpsp;
163 TRACE( "device %p size %u\n", device, out_size );
165 if (!(out_buff = HeapAlloc( GetProcessHeap(), 0, out_size ))) return STATUS_NO_MEMORY;
167 offset.QuadPart = params->read.pos;
169 /* note: we abuse UserIosb to store the server irp handle */
170 if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_READ, device, out_buff, out_size,
171 &offset, NULL, irp_handle )))
173 HeapFree( GetProcessHeap(), 0, out_buff );
174 return STATUS_NO_MEMORY;
177 irpsp = IoGetNextIrpStackLocation( irp );
178 irpsp->Parameters.Read.Key = params->read.key;
180 return dispatch_irp( device, irp );
183 /* process a write request for a given device */
184 static NTSTATUS dispatch_write( DEVICE_OBJECT *device, const irp_params_t *params,
185 void *in_buff, ULONG in_size, ULONG out_size, HANDLE irp_handle )
187 IRP *irp;
188 LARGE_INTEGER offset;
189 IO_STACK_LOCATION *irpsp;
191 TRACE( "device %p size %u\n", device, in_size );
193 offset.QuadPart = params->write.pos;
195 /* note: we abuse UserIosb to store the server irp handle */
196 if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE, device, in_buff, in_size,
197 &offset, NULL, irp_handle )))
198 return STATUS_NO_MEMORY;
200 irpsp = IoGetNextIrpStackLocation( irp );
201 irpsp->Parameters.Write.Key = params->write.key;
203 return dispatch_irp( device, irp );
206 /* process a flush request for a given device */
207 static NTSTATUS dispatch_flush( DEVICE_OBJECT *device, const irp_params_t *params,
208 void *in_buff, ULONG in_size, ULONG out_size, HANDLE irp_handle )
210 IRP *irp;
212 TRACE( "device %p\n", device );
214 /* note: we abuse UserIosb to store the server irp handle */
215 if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_FLUSH_BUFFERS, device, in_buff, in_size,
216 NULL, NULL, irp_handle )))
217 return STATUS_NO_MEMORY;
219 return dispatch_irp( device, irp );
222 /* process an ioctl request for a given device */
223 static NTSTATUS dispatch_ioctl( DEVICE_OBJECT *device, const irp_params_t *params,
224 void *in_buff, ULONG in_size, ULONG out_size, HANDLE irp_handle )
226 IRP *irp;
227 void *out_buff = NULL;
229 TRACE( "ioctl %x device %p in_size %u out_size %u\n", params->ioctl.code, device, in_size, out_size );
231 if ((params->ioctl.code & 3) == METHOD_BUFFERED) out_size = max( in_size, out_size );
233 if (out_size)
235 if (!(out_buff = HeapAlloc( GetProcessHeap(), 0, out_size ))) return STATUS_NO_MEMORY;
236 if ((params->ioctl.code & 3) == METHOD_BUFFERED)
238 memcpy( out_buff, in_buff, in_size );
239 in_buff = out_buff;
243 /* note: we abuse UserIosb to store the server handle to the ioctl */
244 irp = IoBuildDeviceIoControlRequest( params->ioctl.code, device, in_buff, in_size, out_buff, out_size,
245 FALSE, NULL, irp_handle );
246 if (!irp)
248 HeapFree( GetProcessHeap(), 0, out_buff );
249 return STATUS_NO_MEMORY;
251 return dispatch_irp( device, irp );
254 typedef NTSTATUS (*dispatch_func)( DEVICE_OBJECT *device, const irp_params_t *params,
255 void *in_buff, ULONG in_size, ULONG out_size, HANDLE irp_handle );
257 static const dispatch_func dispatch_funcs[IRP_MJ_MAXIMUM_FUNCTION + 1] =
259 NULL, /* IRP_MJ_CREATE */
260 NULL, /* IRP_MJ_CREATE_NAMED_PIPE */
261 NULL, /* IRP_MJ_CLOSE */
262 dispatch_read, /* IRP_MJ_READ */
263 dispatch_write, /* IRP_MJ_WRITE */
264 NULL, /* IRP_MJ_QUERY_INFORMATION */
265 NULL, /* IRP_MJ_SET_INFORMATION */
266 NULL, /* IRP_MJ_QUERY_EA */
267 NULL, /* IRP_MJ_SET_EA */
268 dispatch_flush, /* IRP_MJ_FLUSH_BUFFERS */
269 NULL, /* IRP_MJ_QUERY_VOLUME_INFORMATION */
270 NULL, /* IRP_MJ_SET_VOLUME_INFORMATION */
271 NULL, /* IRP_MJ_DIRECTORY_CONTROL */
272 NULL, /* IRP_MJ_FILE_SYSTEM_CONTROL */
273 dispatch_ioctl, /* IRP_MJ_DEVICE_CONTROL */
274 NULL, /* IRP_MJ_INTERNAL_DEVICE_CONTROL */
275 NULL, /* IRP_MJ_SHUTDOWN */
276 NULL, /* IRP_MJ_LOCK_CONTROL */
277 NULL, /* IRP_MJ_CLEANUP */
278 NULL, /* IRP_MJ_CREATE_MAILSLOT */
279 NULL, /* IRP_MJ_QUERY_SECURITY */
280 NULL, /* IRP_MJ_SET_SECURITY */
281 NULL, /* IRP_MJ_POWER */
282 NULL, /* IRP_MJ_SYSTEM_CONTROL */
283 NULL, /* IRP_MJ_DEVICE_CHANGE */
284 NULL, /* IRP_MJ_QUERY_QUOTA */
285 NULL, /* IRP_MJ_SET_QUOTA */
286 NULL, /* IRP_MJ_PNP */
290 /***********************************************************************
291 * wine_ntoskrnl_main_loop (Not a Windows API)
293 NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
295 HANDLE manager = get_device_manager();
296 HANDLE irp = 0;
297 NTSTATUS status = STATUS_SUCCESS;
298 irp_params_t irp_params;
299 void *in_buff;
300 DEVICE_OBJECT *device = NULL;
301 ULONG in_size = 4096, out_size = 0;
302 HANDLE handles[2];
304 request_thread = GetCurrentThreadId();
306 if (!(in_buff = HeapAlloc( GetProcessHeap(), 0, in_size )))
308 ERR( "failed to allocate buffer\n" );
309 return STATUS_NO_MEMORY;
312 handles[0] = stop_event;
313 handles[1] = manager;
315 for (;;)
317 SERVER_START_REQ( get_next_device_request )
319 req->manager = wine_server_obj_handle( manager );
320 req->prev = wine_server_obj_handle( irp );
321 req->status = status;
322 wine_server_set_reply( req, in_buff, in_size );
323 if (!(status = wine_server_call( req )))
325 irp = wine_server_ptr_handle( reply->next );
326 device = wine_server_get_ptr( reply->user_ptr );
327 irp_params = reply->params;
328 client_tid = reply->client_tid;
329 client_pid = reply->client_pid;
330 in_size = reply->in_size;
331 out_size = reply->out_size;
333 else
335 irp = 0; /* no previous irp */
336 out_size = 0;
337 in_size = reply->in_size;
340 SERVER_END_REQ;
342 switch(status)
344 case STATUS_SUCCESS:
345 if (irp_params.major > IRP_MJ_MAXIMUM_FUNCTION ||
346 !dispatch_funcs[irp_params.major] ||
347 !device->DriverObject->MajorFunction[irp_params.major])
349 WARN( "unsupported request %u\n", irp_params.major );
350 status = STATUS_NOT_SUPPORTED;
351 break;
353 status = dispatch_funcs[irp_params.major]( device, &irp_params,
354 in_buff, in_size, out_size, irp );
355 if (status == STATUS_SUCCESS) irp = 0; /* status reported by IoCompleteRequest */
356 break;
357 case STATUS_BUFFER_OVERFLOW:
358 HeapFree( GetProcessHeap(), 0, in_buff );
359 in_buff = HeapAlloc( GetProcessHeap(), 0, in_size );
360 /* restart with larger buffer */
361 break;
362 case STATUS_PENDING:
363 for (;;)
365 DWORD ret = WaitForMultipleObjectsEx( 2, handles, FALSE, INFINITE, TRUE );
366 if (ret == WAIT_OBJECT_0)
368 HeapFree( GetProcessHeap(), 0, in_buff );
369 return STATUS_SUCCESS;
371 if (ret != WAIT_IO_COMPLETION) break;
373 break;
379 /***********************************************************************
380 * IoAcquireCancelSpinLock (NTOSKRNL.EXE.@)
382 void WINAPI IoAcquireCancelSpinLock(PKIRQL irql)
384 FIXME("(%p): stub\n", irql);
388 /***********************************************************************
389 * IoReleaseCancelSpinLock (NTOSKRNL.EXE.@)
391 void WINAPI IoReleaseCancelSpinLock(PKIRQL irql)
393 FIXME("(%p): stub\n", irql);
397 /***********************************************************************
398 * IoAllocateDriverObjectExtension (NTOSKRNL.EXE.@)
400 NTSTATUS WINAPI IoAllocateDriverObjectExtension( PDRIVER_OBJECT DriverObject,
401 PVOID ClientIdentificationAddress,
402 ULONG DriverObjectExtensionSize,
403 PVOID *DriverObjectExtension )
405 FIXME( "stub: %p, %p, %u, %p\n", DriverObject, ClientIdentificationAddress,
406 DriverObjectExtensionSize, DriverObjectExtension );
407 return STATUS_NOT_IMPLEMENTED;
411 /***********************************************************************
412 * IoGetDriverObjectExtension (NTOSKRNL.EXE.@)
414 PVOID WINAPI IoGetDriverObjectExtension( PDRIVER_OBJECT DriverObject,
415 PVOID ClientIdentificationAddress )
417 FIXME( "stub: %p, %p\n", DriverObject, ClientIdentificationAddress );
418 return NULL;
422 /***********************************************************************
423 * IoInitializeIrp (NTOSKRNL.EXE.@)
425 void WINAPI IoInitializeIrp( IRP *irp, USHORT size, CCHAR stack_size )
427 TRACE( "%p, %u, %d\n", irp, size, stack_size );
429 RtlZeroMemory( irp, size );
431 irp->Type = IO_TYPE_IRP;
432 irp->Size = size;
433 InitializeListHead( &irp->ThreadListEntry );
434 irp->StackCount = stack_size;
435 irp->CurrentLocation = stack_size + 1;
436 irp->Tail.Overlay.s.u2.CurrentStackLocation =
437 (PIO_STACK_LOCATION)(irp + 1) + stack_size;
441 /***********************************************************************
442 * IoInitializeTimer (NTOSKRNL.EXE.@)
444 NTSTATUS WINAPI IoInitializeTimer(PDEVICE_OBJECT DeviceObject,
445 PIO_TIMER_ROUTINE TimerRoutine,
446 PVOID Context)
448 FIXME( "stub: %p, %p, %p\n", DeviceObject, TimerRoutine, Context );
449 return STATUS_NOT_IMPLEMENTED;
453 /***********************************************************************
454 * IoStartTimer (NTOSKRNL.EXE.@)
456 void WINAPI IoStartTimer(PDEVICE_OBJECT DeviceObject)
458 FIXME( "stub: %p\n", DeviceObject );
462 /***********************************************************************
463 * IoAllocateIrp (NTOSKRNL.EXE.@)
465 PIRP WINAPI IoAllocateIrp( CCHAR stack_size, BOOLEAN charge_quota )
467 SIZE_T size;
468 PIRP irp;
470 TRACE( "%d, %d\n", stack_size, charge_quota );
472 size = sizeof(IRP) + stack_size * sizeof(IO_STACK_LOCATION);
473 irp = ExAllocatePool( NonPagedPool, size );
474 if (irp == NULL)
475 return NULL;
476 IoInitializeIrp( irp, size, stack_size );
477 irp->AllocationFlags = IRP_ALLOCATED_FIXED_SIZE;
478 if (charge_quota)
479 irp->AllocationFlags |= IRP_LOOKASIDE_ALLOCATION;
480 return irp;
484 /***********************************************************************
485 * IoFreeIrp (NTOSKRNL.EXE.@)
487 void WINAPI IoFreeIrp( IRP *irp )
489 MDL *mdl;
491 TRACE( "%p\n", irp );
493 mdl = irp->MdlAddress;
494 while (mdl)
496 MDL *next = mdl->Next;
497 IoFreeMdl( mdl );
498 mdl = next;
501 ExFreePool( irp );
505 /***********************************************************************
506 * IoAllocateErrorLogEntry (NTOSKRNL.EXE.@)
508 PVOID WINAPI IoAllocateErrorLogEntry( PVOID IoObject, UCHAR EntrySize )
510 FIXME( "stub: %p, %u\n", IoObject, EntrySize );
511 return NULL;
515 /***********************************************************************
516 * IoAllocateMdl (NTOSKRNL.EXE.@)
518 PMDL WINAPI IoAllocateMdl( PVOID va, ULONG length, BOOLEAN secondary, BOOLEAN charge_quota, IRP *irp )
520 PMDL mdl;
521 ULONG_PTR address = (ULONG_PTR)va;
522 ULONG_PTR page_address;
523 SIZE_T nb_pages, mdl_size;
525 TRACE("(%p, %u, %i, %i, %p)\n", va, length, secondary, charge_quota, irp);
527 if (charge_quota)
528 FIXME("Charge quota is not yet supported\n");
530 /* FIXME: We suppose that page size is 4096 */
531 page_address = address & ~(4096 - 1);
532 nb_pages = (((address + length - 1) & ~(4096 - 1)) - page_address) / 4096 + 1;
534 mdl_size = sizeof(MDL) + nb_pages * sizeof(PVOID);
536 mdl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mdl_size);
537 if (!mdl)
538 return NULL;
540 mdl->Size = mdl_size;
541 mdl->Process = NULL; /* FIXME: IoGetCurrentProcess */
542 mdl->StartVa = (PVOID)page_address;
543 mdl->ByteCount = length;
544 mdl->ByteOffset = address - page_address;
546 if (!irp) return mdl;
548 if (secondary) /* add it at the end */
550 MDL **pmdl = &irp->MdlAddress;
551 while (*pmdl) pmdl = &(*pmdl)->Next;
552 *pmdl = mdl;
554 else
556 mdl->Next = irp->MdlAddress;
557 irp->MdlAddress = mdl;
559 return mdl;
563 /***********************************************************************
564 * IoFreeMdl (NTOSKRNL.EXE.@)
566 void WINAPI IoFreeMdl(PMDL mdl)
568 TRACE("%p\n", mdl);
569 HeapFree(GetProcessHeap(), 0, mdl);
573 /***********************************************************************
574 * IoAllocateWorkItem (NTOSKRNL.EXE.@)
576 PIO_WORKITEM WINAPI IoAllocateWorkItem( PDEVICE_OBJECT DeviceObject )
578 FIXME( "stub: %p\n", DeviceObject );
579 return NULL;
583 /***********************************************************************
584 * IoAttachDeviceToDeviceStack (NTOSKRNL.EXE.@)
586 PDEVICE_OBJECT WINAPI IoAttachDeviceToDeviceStack( DEVICE_OBJECT *source,
587 DEVICE_OBJECT *target )
589 TRACE( "%p, %p\n", source, target );
590 target->AttachedDevice = source;
591 source->StackSize = target->StackSize + 1;
592 return target;
596 /***********************************************************************
597 * IoBuildDeviceIoControlRequest (NTOSKRNL.EXE.@)
599 PIRP WINAPI IoBuildDeviceIoControlRequest( ULONG code, PDEVICE_OBJECT device,
600 PVOID in_buff, ULONG in_len,
601 PVOID out_buff, ULONG out_len,
602 BOOLEAN internal, PKEVENT event,
603 PIO_STATUS_BLOCK iosb )
605 PIRP irp;
606 PIO_STACK_LOCATION irpsp;
608 TRACE( "%x, %p, %p, %u, %p, %u, %u, %p, %p\n",
609 code, device, in_buff, in_len, out_buff, out_len, internal, event, iosb );
611 if (device == NULL)
612 return NULL;
614 irp = IoAllocateIrp( device->StackSize, FALSE );
615 if (irp == NULL)
616 return NULL;
618 irpsp = IoGetNextIrpStackLocation( irp );
619 irpsp->MajorFunction = internal ? IRP_MJ_INTERNAL_DEVICE_CONTROL : IRP_MJ_DEVICE_CONTROL;
620 irpsp->Parameters.DeviceIoControl.IoControlCode = code;
621 irpsp->Parameters.DeviceIoControl.InputBufferLength = in_len;
622 irpsp->Parameters.DeviceIoControl.OutputBufferLength = out_len;
623 irpsp->DeviceObject = device;
624 irpsp->CompletionRoutine = NULL;
626 switch (code & 3)
628 case METHOD_BUFFERED:
629 irp->AssociatedIrp.SystemBuffer = in_buff;
630 break;
631 case METHOD_IN_DIRECT:
632 case METHOD_OUT_DIRECT:
633 irp->AssociatedIrp.SystemBuffer = in_buff;
634 IoAllocateMdl( out_buff, out_len, FALSE, FALSE, irp );
635 break;
636 case METHOD_NEITHER:
637 irpsp->Parameters.DeviceIoControl.Type3InputBuffer = in_buff;
638 break;
641 irp->RequestorMode = KernelMode;
642 irp->UserBuffer = out_buff;
643 irp->UserIosb = iosb;
644 irp->UserEvent = event;
645 return irp;
649 /**********************************************************
650 * IoBuildSynchronousFsdRequest (NTOSKRNL.EXE.@)
652 PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG majorfunc, PDEVICE_OBJECT device,
653 PVOID buffer, ULONG length, PLARGE_INTEGER startoffset,
654 PKEVENT event, PIO_STATUS_BLOCK iosb)
656 PIRP irp;
657 PIO_STACK_LOCATION irpsp;
659 TRACE("(%d %p %p %d %p %p %p)\n", majorfunc, device, buffer, length, startoffset, event, iosb);
661 if (!(irp = IoAllocateIrp( device->StackSize, FALSE ))) return NULL;
663 irpsp = IoGetNextIrpStackLocation( irp );
664 irpsp->MajorFunction = majorfunc;
665 irpsp->DeviceObject = device;
666 irpsp->CompletionRoutine = NULL;
668 irp->AssociatedIrp.SystemBuffer = buffer;
669 if (device->Flags & DO_DIRECT_IO) IoAllocateMdl( buffer, length, FALSE, FALSE, irp );
671 switch (majorfunc)
673 case IRP_MJ_READ:
674 irpsp->Parameters.Read.Length = length;
675 irpsp->Parameters.Read.ByteOffset = *startoffset;
676 break;
677 case IRP_MJ_WRITE:
678 irpsp->Parameters.Write.Length = length;
679 irpsp->Parameters.Write.ByteOffset = *startoffset;
680 break;
682 irp->RequestorMode = KernelMode;
683 irp->UserIosb = iosb;
684 irp->UserEvent = event;
685 irp->UserBuffer = buffer;
686 return irp;
690 /***********************************************************************
691 * IoCreateDriver (NTOSKRNL.EXE.@)
693 NTSTATUS WINAPI IoCreateDriver( UNICODE_STRING *name, PDRIVER_INITIALIZE init )
695 DRIVER_OBJECT *driver;
696 DRIVER_EXTENSION *extension;
697 NTSTATUS status;
699 TRACE("(%s, %p)\n", debugstr_us(name), init);
701 if (!(driver = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY,
702 sizeof(*driver) + sizeof(*extension) )))
703 return STATUS_NO_MEMORY;
705 if ((status = RtlDuplicateUnicodeString( 1, name, &driver->DriverName )))
707 RtlFreeHeap( GetProcessHeap(), 0, driver );
708 return status;
711 extension = (DRIVER_EXTENSION *)(driver + 1);
712 driver->Size = sizeof(*driver);
713 driver->DriverInit = init;
714 driver->DriverExtension = extension;
715 extension->DriverObject = driver;
716 extension->ServiceKeyName = driver->DriverName;
718 status = driver->DriverInit( driver, name );
720 if (status)
722 RtlFreeUnicodeString( &driver->DriverName );
723 RtlFreeHeap( GetProcessHeap(), 0, driver );
725 return status;
729 /***********************************************************************
730 * IoDeleteDriver (NTOSKRNL.EXE.@)
732 void WINAPI IoDeleteDriver( DRIVER_OBJECT *driver )
734 TRACE("(%p)\n", driver);
736 RtlFreeUnicodeString( &driver->DriverName );
737 RtlFreeHeap( GetProcessHeap(), 0, driver );
741 /***********************************************************************
742 * IoCreateDevice (NTOSKRNL.EXE.@)
744 NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
745 UNICODE_STRING *name, DEVICE_TYPE type,
746 ULONG characteristics, BOOLEAN exclusive,
747 DEVICE_OBJECT **ret_device )
749 NTSTATUS status;
750 DEVICE_OBJECT *device;
751 HANDLE handle = 0;
752 HANDLE manager = get_device_manager();
754 TRACE( "(%p, %u, %s, %u, %x, %u, %p)\n",
755 driver, ext_size, debugstr_us(name), type, characteristics, exclusive, ret_device );
757 if (!(device = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*device) + ext_size )))
758 return STATUS_NO_MEMORY;
760 SERVER_START_REQ( create_device )
762 req->access = 0;
763 req->attributes = 0;
764 req->rootdir = 0;
765 req->manager = wine_server_obj_handle( manager );
766 req->user_ptr = wine_server_client_ptr( device );
767 if (name) wine_server_add_data( req, name->Buffer, name->Length );
768 if (!(status = wine_server_call( req ))) handle = wine_server_ptr_handle( reply->handle );
770 SERVER_END_REQ;
772 if (status == STATUS_SUCCESS)
774 device->DriverObject = driver;
775 device->DeviceExtension = device + 1;
776 device->DeviceType = type;
777 device->StackSize = 1;
778 device->Reserved = handle;
780 device->NextDevice = driver->DeviceObject;
781 driver->DeviceObject = device;
783 *ret_device = device;
785 else HeapFree( GetProcessHeap(), 0, device );
787 return status;
791 /***********************************************************************
792 * IoDeleteDevice (NTOSKRNL.EXE.@)
794 void WINAPI IoDeleteDevice( DEVICE_OBJECT *device )
796 NTSTATUS status;
798 TRACE( "%p\n", device );
800 SERVER_START_REQ( delete_device )
802 req->handle = wine_server_obj_handle( device->Reserved );
803 status = wine_server_call( req );
805 SERVER_END_REQ;
807 if (status == STATUS_SUCCESS)
809 DEVICE_OBJECT **prev = &device->DriverObject->DeviceObject;
810 while (*prev && *prev != device) prev = &(*prev)->NextDevice;
811 if (*prev) *prev = (*prev)->NextDevice;
812 NtClose( device->Reserved );
813 HeapFree( GetProcessHeap(), 0, device );
818 /***********************************************************************
819 * IoCreateSymbolicLink (NTOSKRNL.EXE.@)
821 NTSTATUS WINAPI IoCreateSymbolicLink( UNICODE_STRING *name, UNICODE_STRING *target )
823 HANDLE handle;
824 OBJECT_ATTRIBUTES attr;
826 attr.Length = sizeof(attr);
827 attr.RootDirectory = 0;
828 attr.ObjectName = name;
829 attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF;
830 attr.SecurityDescriptor = NULL;
831 attr.SecurityQualityOfService = NULL;
833 TRACE( "%s -> %s\n", debugstr_us(name), debugstr_us(target) );
834 /* FIXME: store handle somewhere */
835 return NtCreateSymbolicLinkObject( &handle, SYMBOLIC_LINK_ALL_ACCESS, &attr, target );
839 /***********************************************************************
840 * IoDeleteSymbolicLink (NTOSKRNL.EXE.@)
842 NTSTATUS WINAPI IoDeleteSymbolicLink( UNICODE_STRING *name )
844 HANDLE handle;
845 OBJECT_ATTRIBUTES attr;
846 NTSTATUS status;
848 attr.Length = sizeof(attr);
849 attr.RootDirectory = 0;
850 attr.ObjectName = name;
851 attr.Attributes = OBJ_CASE_INSENSITIVE;
852 attr.SecurityDescriptor = NULL;
853 attr.SecurityQualityOfService = NULL;
855 if (!(status = NtOpenSymbolicLinkObject( &handle, 0, &attr )))
857 SERVER_START_REQ( unlink_object )
859 req->handle = wine_server_obj_handle( handle );
860 status = wine_server_call( req );
862 SERVER_END_REQ;
863 NtClose( handle );
865 return status;
869 /***********************************************************************
870 * IoGetDeviceInterfaces (NTOSKRNL.EXE.@)
872 NTSTATUS WINAPI IoGetDeviceInterfaces( const GUID *InterfaceClassGuid,
873 PDEVICE_OBJECT PhysicalDeviceObject,
874 ULONG Flags, PWSTR *SymbolicLinkList )
876 FIXME( "stub: %s %p %x %p\n", debugstr_guid(InterfaceClassGuid),
877 PhysicalDeviceObject, Flags, SymbolicLinkList );
878 return STATUS_NOT_IMPLEMENTED;
882 /***********************************************************************
883 * IoGetDeviceObjectPointer (NTOSKRNL.EXE.@)
885 NTSTATUS WINAPI IoGetDeviceObjectPointer( UNICODE_STRING *name, ACCESS_MASK access, PFILE_OBJECT *file, PDEVICE_OBJECT *device )
887 FIXME( "stub: %s %x %p %p\n", debugstr_us(name), access, file, device );
889 *file = NULL;
890 *device = NULL;
892 return STATUS_SUCCESS;
895 /***********************************************************************
896 * IoGetAttachedDevice (NTOSKRNL.EXE.@)
898 PDEVICE_OBJECT WINAPI IoGetAttachedDevice( PDEVICE_OBJECT device )
900 FIXME( "stub: %p\n", device );
902 return device;
905 /***********************************************************************
906 * IoGetDeviceProperty (NTOSKRNL.EXE.@)
908 NTSTATUS WINAPI IoGetDeviceProperty( DEVICE_OBJECT *device, DEVICE_REGISTRY_PROPERTY device_property,
909 ULONG buffer_length, PVOID property_buffer, PULONG result_length )
911 FIXME( "%p %d %u %p %p: stub\n", device, device_property, buffer_length,
912 property_buffer, result_length );
913 return STATUS_NOT_IMPLEMENTED;
917 /***********************************************************************
918 * IoCallDriver (NTOSKRNL.EXE.@)
920 NTSTATUS WINAPI IoCallDriver( DEVICE_OBJECT *device, IRP *irp )
922 PDRIVER_DISPATCH dispatch;
923 IO_STACK_LOCATION *irpsp;
924 NTSTATUS status;
926 --irp->CurrentLocation;
927 irpsp = --irp->Tail.Overlay.s.u2.CurrentStackLocation;
928 dispatch = device->DriverObject->MajorFunction[irpsp->MajorFunction];
930 if (TRACE_ON(relay))
931 DPRINTF( "%04x:Call driver dispatch %p (device=%p,irp=%p)\n",
932 GetCurrentThreadId(), dispatch, device, irp );
934 status = dispatch( device, irp );
936 if (TRACE_ON(relay))
937 DPRINTF( "%04x:Ret driver dispatch %p (device=%p,irp=%p) retval=%08x\n",
938 GetCurrentThreadId(), dispatch, device, irp, status );
940 return status;
944 /***********************************************************************
945 * IofCallDriver (NTOSKRNL.EXE.@)
947 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
948 DEFINE_FASTCALL2_ENTRYPOINT( IofCallDriver )
949 NTSTATUS WINAPI __regs_IofCallDriver( DEVICE_OBJECT *device, IRP *irp )
950 #else
951 NTSTATUS WINAPI IofCallDriver( DEVICE_OBJECT *device, IRP *irp )
952 #endif
954 TRACE( "%p %p\n", device, irp );
955 return IoCallDriver( device, irp );
959 /***********************************************************************
960 * IoGetRelatedDeviceObject (NTOSKRNL.EXE.@)
962 PDEVICE_OBJECT WINAPI IoGetRelatedDeviceObject( PFILE_OBJECT obj )
964 FIXME( "stub: %p\n", obj );
965 return NULL;
968 static CONFIGURATION_INFORMATION configuration_information;
970 /***********************************************************************
971 * IoGetConfigurationInformation (NTOSKRNL.EXE.@)
973 PCONFIGURATION_INFORMATION WINAPI IoGetConfigurationInformation(void)
975 FIXME( "partial stub\n" );
976 /* FIXME: return actual devices on system */
977 return &configuration_information;
981 /***********************************************************************
982 * IoIsWdmVersionAvailable (NTOSKRNL.EXE.@)
984 NTSTATUS WINAPI IoIsWdmVersionAvailable(UCHAR MajorVersion, UCHAR MinorVersion)
986 DWORD version;
987 DWORD major;
988 DWORD minor;
990 TRACE( "%d, 0x%X\n", MajorVersion, MinorVersion );
992 version = GetVersion();
993 major = LOBYTE(version);
994 minor = HIBYTE(LOWORD(version));
996 if (MajorVersion == 6 && MinorVersion == 0)
998 /* Windows Vista, Windows Server 2008, Windows 7 */
1000 else if (MajorVersion == 1)
1002 if (MinorVersion == 0x30)
1004 /* Windows server 2003 */
1005 MajorVersion = 6;
1006 MinorVersion = 0;
1008 else if (MinorVersion == 0x20)
1010 /* Windows XP */
1011 MajorVersion = 5;
1012 MinorVersion = 1;
1014 else if (MinorVersion == 0x10)
1016 /* Windows 2000 */
1017 MajorVersion = 5;
1018 MinorVersion = 0;
1020 else if (MinorVersion == 0x05)
1022 /* Windows ME */
1023 MajorVersion = 4;
1024 MinorVersion = 0x5a;
1026 else if (MinorVersion == 0x00)
1028 /* Windows 98 */
1029 MajorVersion = 4;
1030 MinorVersion = 0x0a;
1032 else
1034 FIXME( "unknown major %d minor 0x%X\n", MajorVersion, MinorVersion );
1035 return FALSE;
1038 else
1040 FIXME( "unknown major %d minor 0x%X\n", MajorVersion, MinorVersion );
1041 return FALSE;
1043 return major > MajorVersion || (major == MajorVersion && minor >= MinorVersion);
1047 /***********************************************************************
1048 * IoQueryDeviceDescription (NTOSKRNL.EXE.@)
1050 NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE itype, PULONG bus, PCONFIGURATION_TYPE ctype,
1051 PULONG cnum, PCONFIGURATION_TYPE ptype, PULONG pnum,
1052 PIO_QUERY_DEVICE_ROUTINE callout, PVOID context)
1054 FIXME( "(%p %p %p %p %p %p %p %p)\n", itype, bus, ctype, cnum, ptype, pnum, callout, context);
1055 return STATUS_NOT_IMPLEMENTED;
1059 /***********************************************************************
1060 * IoRegisterDriverReinitialization (NTOSKRNL.EXE.@)
1062 void WINAPI IoRegisterDriverReinitialization( PDRIVER_OBJECT obj, PDRIVER_REINITIALIZE reinit, PVOID context )
1064 FIXME( "stub: %p %p %p\n", obj, reinit, context );
1068 /***********************************************************************
1069 * IoRegisterShutdownNotification (NTOSKRNL.EXE.@)
1071 NTSTATUS WINAPI IoRegisterShutdownNotification( PDEVICE_OBJECT obj )
1073 FIXME( "stub: %p\n", obj );
1074 return STATUS_SUCCESS;
1078 /***********************************************************************
1079 * IoUnregisterShutdownNotification (NTOSKRNL.EXE.@)
1081 VOID WINAPI IoUnregisterShutdownNotification( PDEVICE_OBJECT obj )
1083 FIXME( "stub: %p\n", obj );
1087 /***********************************************************************
1088 * IoReportResourceUsage (NTOSKRNL.EXE.@)
1090 NTSTATUS WINAPI IoReportResourceUsage(PUNICODE_STRING name, PDRIVER_OBJECT drv_obj, PCM_RESOURCE_LIST drv_list,
1091 ULONG drv_size, PDRIVER_OBJECT dev_obj, PCM_RESOURCE_LIST dev_list,
1092 ULONG dev_size, BOOLEAN overwrite, PBOOLEAN detected)
1094 FIXME("(%s %p %p %u %p %p %u %d %p) stub\n", debugstr_w(name? name->Buffer : NULL),
1095 drv_obj, drv_list, drv_size, dev_obj, dev_list, dev_size, overwrite, detected);
1096 return STATUS_NOT_IMPLEMENTED;
1100 /***********************************************************************
1101 * IoCompleteRequest (NTOSKRNL.EXE.@)
1103 VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
1105 IO_STACK_LOCATION *irpsp;
1106 PIO_COMPLETION_ROUTINE routine;
1107 NTSTATUS status, stat;
1108 HANDLE handle;
1109 int call_flag = 0;
1111 TRACE( "%p %u\n", irp, priority_boost );
1113 status = irp->IoStatus.u.Status;
1114 while (irp->CurrentLocation <= irp->StackCount)
1116 irpsp = irp->Tail.Overlay.s.u2.CurrentStackLocation;
1117 routine = irpsp->CompletionRoutine;
1118 call_flag = 0;
1119 /* FIXME: add SL_INVOKE_ON_CANCEL support */
1120 if (routine)
1122 if ((irpsp->Control & SL_INVOKE_ON_SUCCESS) && STATUS_SUCCESS == status)
1123 call_flag = 1;
1124 if ((irpsp->Control & SL_INVOKE_ON_ERROR) && STATUS_SUCCESS != status)
1125 call_flag = 1;
1127 ++irp->CurrentLocation;
1128 ++irp->Tail.Overlay.s.u2.CurrentStackLocation;
1129 if (call_flag)
1131 TRACE( "calling %p( %p, %p, %p )\n", routine,
1132 irpsp->DeviceObject, irp, irpsp->Context );
1133 stat = routine( irpsp->DeviceObject, irp, irpsp->Context );
1134 TRACE( "CompletionRoutine returned %x\n", stat );
1135 if (STATUS_MORE_PROCESSING_REQUIRED == stat)
1136 return;
1140 handle = (HANDLE)irp->UserIosb;
1141 if (handle)
1143 HANDLE manager = get_device_manager();
1144 void *out_buff = irp->UserBuffer;
1146 SERVER_START_REQ( set_irp_result )
1148 req->manager = wine_server_obj_handle( manager );
1149 req->handle = wine_server_obj_handle( handle );
1150 req->status = irp->IoStatus.u.Status;
1151 if (irp->IoStatus.u.Status >= 0)
1153 req->size = irp->IoStatus.Information;
1154 if (out_buff) wine_server_add_data( req, out_buff, irp->IoStatus.Information );
1156 wine_server_call( req );
1158 SERVER_END_REQ;
1159 HeapFree( GetProcessHeap(), 0, out_buff );
1162 IoFreeIrp( irp );
1166 /***********************************************************************
1167 * IofCompleteRequest (NTOSKRNL.EXE.@)
1169 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
1170 DEFINE_FASTCALL2_ENTRYPOINT( IofCompleteRequest )
1171 void WINAPI __regs_IofCompleteRequest( IRP *irp, UCHAR priority_boost )
1172 #else
1173 void WINAPI IofCompleteRequest( IRP *irp, UCHAR priority_boost )
1174 #endif
1176 TRACE( "%p %u\n", irp, priority_boost );
1177 IoCompleteRequest( irp, priority_boost );
1181 /***********************************************************************
1182 * InterlockedCompareExchange (NTOSKRNL.EXE.@)
1184 #ifdef DEFINE_FASTCALL3_ENTRYPOINT
1185 DEFINE_FASTCALL3_ENTRYPOINT( NTOSKRNL_InterlockedCompareExchange )
1186 LONG WINAPI __regs_NTOSKRNL_InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
1187 #else
1188 LONG WINAPI NTOSKRNL_InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
1189 #endif
1191 return InterlockedCompareExchange( dest, xchg, compare );
1195 /***********************************************************************
1196 * InterlockedDecrement (NTOSKRNL.EXE.@)
1198 #ifdef DEFINE_FASTCALL1_ENTRYPOINT
1199 DEFINE_FASTCALL1_ENTRYPOINT( NTOSKRNL_InterlockedDecrement )
1200 LONG WINAPI __regs_NTOSKRNL_InterlockedDecrement( LONG volatile *dest )
1201 #else
1202 LONG WINAPI NTOSKRNL_InterlockedDecrement( LONG volatile *dest )
1203 #endif
1205 return InterlockedDecrement( dest );
1209 /***********************************************************************
1210 * InterlockedExchange (NTOSKRNL.EXE.@)
1212 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
1213 DEFINE_FASTCALL2_ENTRYPOINT( NTOSKRNL_InterlockedExchange )
1214 LONG WINAPI __regs_NTOSKRNL_InterlockedExchange( LONG volatile *dest, LONG val )
1215 #else
1216 LONG WINAPI NTOSKRNL_InterlockedExchange( LONG volatile *dest, LONG val )
1217 #endif
1219 return InterlockedExchange( dest, val );
1223 /***********************************************************************
1224 * InterlockedExchangeAdd (NTOSKRNL.EXE.@)
1226 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
1227 DEFINE_FASTCALL2_ENTRYPOINT( NTOSKRNL_InterlockedExchangeAdd )
1228 LONG WINAPI __regs_NTOSKRNL_InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
1229 #else
1230 LONG WINAPI NTOSKRNL_InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
1231 #endif
1233 return InterlockedExchangeAdd( dest, incr );
1237 /***********************************************************************
1238 * InterlockedIncrement (NTOSKRNL.EXE.@)
1240 #ifdef DEFINE_FASTCALL1_ENTRYPOINT
1241 DEFINE_FASTCALL1_ENTRYPOINT( NTOSKRNL_InterlockedIncrement )
1242 LONG WINAPI __regs_NTOSKRNL_InterlockedIncrement( LONG volatile *dest )
1243 #else
1244 LONG WINAPI NTOSKRNL_InterlockedIncrement( LONG volatile *dest )
1245 #endif
1247 return InterlockedIncrement( dest );
1251 /***********************************************************************
1252 * ExAllocatePool (NTOSKRNL.EXE.@)
1254 PVOID WINAPI ExAllocatePool( POOL_TYPE type, SIZE_T size )
1256 return ExAllocatePoolWithTag( type, size, 0 );
1260 /***********************************************************************
1261 * ExAllocatePoolWithQuota (NTOSKRNL.EXE.@)
1263 PVOID WINAPI ExAllocatePoolWithQuota( POOL_TYPE type, SIZE_T size )
1265 return ExAllocatePoolWithTag( type, size, 0 );
1269 /***********************************************************************
1270 * ExAllocatePoolWithTag (NTOSKRNL.EXE.@)
1272 PVOID WINAPI ExAllocatePoolWithTag( POOL_TYPE type, SIZE_T size, ULONG tag )
1274 /* FIXME: handle page alignment constraints */
1275 void *ret = HeapAlloc( GetProcessHeap(), 0, size );
1276 TRACE( "%lu pool %u -> %p\n", size, type, ret );
1277 return ret;
1281 /***********************************************************************
1282 * ExAllocatePoolWithQuotaTag (NTOSKRNL.EXE.@)
1284 PVOID WINAPI ExAllocatePoolWithQuotaTag( POOL_TYPE type, SIZE_T size, ULONG tag )
1286 return ExAllocatePoolWithTag( type, size, tag );
1290 /***********************************************************************
1291 * ExCreateCallback (NTOSKRNL.EXE.@)
1293 NTSTATUS WINAPI ExCreateCallback(PCALLBACK_OBJECT *obj, POBJECT_ATTRIBUTES attr,
1294 BOOLEAN create, BOOLEAN allow_multiple)
1296 FIXME("(%p, %p, %u, %u): stub\n", obj, attr, create, allow_multiple);
1298 return STATUS_NOT_IMPLEMENTED;
1302 /***********************************************************************
1303 * ExFreePool (NTOSKRNL.EXE.@)
1305 void WINAPI ExFreePool( void *ptr )
1307 ExFreePoolWithTag( ptr, 0 );
1311 /***********************************************************************
1312 * ExFreePoolWithTag (NTOSKRNL.EXE.@)
1314 void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag )
1316 TRACE( "%p\n", ptr );
1317 HeapFree( GetProcessHeap(), 0, ptr );
1321 /***********************************************************************
1322 * ExInitializeResourceLite (NTOSKRNL.EXE.@)
1324 NTSTATUS WINAPI ExInitializeResourceLite(PERESOURCE Resource)
1326 FIXME( "stub: %p\n", Resource );
1327 return STATUS_NOT_IMPLEMENTED;
1331 /***********************************************************************
1332 * ExInitializeNPagedLookasideList (NTOSKRNL.EXE.@)
1334 void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
1335 PALLOCATE_FUNCTION Allocate,
1336 PFREE_FUNCTION Free,
1337 ULONG Flags,
1338 SIZE_T Size,
1339 ULONG Tag,
1340 USHORT Depth)
1342 FIXME( "stub: %p, %p, %p, %u, %lu, %u, %u\n", Lookaside, Allocate, Free, Flags, Size, Tag, Depth );
1345 /***********************************************************************
1346 * ExInitializePagedLookasideList (NTOSKRNL.EXE.@)
1348 void WINAPI ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
1349 PALLOCATE_FUNCTION Allocate,
1350 PFREE_FUNCTION Free,
1351 ULONG Flags,
1352 SIZE_T Size,
1353 ULONG Tag,
1354 USHORT Depth)
1356 FIXME( "stub: %p, %p, %p, %u, %lu, %u, %u\n", Lookaside, Allocate, Free, Flags, Size, Tag, Depth );
1359 /***********************************************************************
1360 * ExInitializeZone (NTOSKRNL.EXE.@)
1362 NTSTATUS WINAPI ExInitializeZone(PZONE_HEADER Zone,
1363 ULONG BlockSize,
1364 PVOID InitialSegment,
1365 ULONG InitialSegmentSize)
1367 FIXME( "stub: %p, %u, %p, %u\n", Zone, BlockSize, InitialSegment, InitialSegmentSize );
1368 return STATUS_NOT_IMPLEMENTED;
1371 /***********************************************************************
1372 * FsRtlRegisterUncProvider (NTOSKRNL.EXE.@)
1374 NTSTATUS WINAPI FsRtlRegisterUncProvider(PHANDLE MupHandle, PUNICODE_STRING RedirDevName,
1375 BOOLEAN MailslotsSupported)
1377 FIXME("(%p %p %d): stub\n", MupHandle, RedirDevName, MailslotsSupported);
1378 return STATUS_NOT_IMPLEMENTED;
1381 /***********************************************************************
1382 * IoGetCurrentProcess / PsGetCurrentProcess (NTOSKRNL.EXE.@)
1384 PEPROCESS WINAPI IoGetCurrentProcess(void)
1386 FIXME("() stub\n");
1387 return NULL;
1390 /***********************************************************************
1391 * KeGetCurrentThread / PsGetCurrentThread (NTOSKRNL.EXE.@)
1393 PRKTHREAD WINAPI KeGetCurrentThread(void)
1395 FIXME("() stub\n");
1396 return NULL;
1399 /***********************************************************************
1400 * KeInitializeEvent (NTOSKRNL.EXE.@)
1402 void WINAPI KeInitializeEvent( PRKEVENT Event, EVENT_TYPE Type, BOOLEAN State )
1404 FIXME( "stub: %p %d %d\n", Event, Type, State );
1408 /***********************************************************************
1409 * KeInitializeMutex (NTOSKRNL.EXE.@)
1411 void WINAPI KeInitializeMutex(PRKMUTEX Mutex, ULONG Level)
1413 FIXME( "stub: %p, %u\n", Mutex, Level );
1417 /***********************************************************************
1418 * KeWaitForMutexObject (NTOSKRNL.EXE.@)
1420 NTSTATUS WINAPI KeWaitForMutexObject(PRKMUTEX Mutex, KWAIT_REASON WaitReason, KPROCESSOR_MODE WaitMode,
1421 BOOLEAN Alertable, PLARGE_INTEGER Timeout)
1423 FIXME( "stub: %p, %d, %d, %d, %p\n", Mutex, WaitReason, WaitMode, Alertable, Timeout );
1424 return STATUS_NOT_IMPLEMENTED;
1428 /***********************************************************************
1429 * KeReleaseMutex (NTOSKRNL.EXE.@)
1431 LONG WINAPI KeReleaseMutex(PRKMUTEX Mutex, BOOLEAN Wait)
1433 FIXME( "stub: %p, %d\n", Mutex, Wait );
1434 return STATUS_NOT_IMPLEMENTED;
1438 /***********************************************************************
1439 * KeInitializeSemaphore (NTOSKRNL.EXE.@)
1441 void WINAPI KeInitializeSemaphore( PRKSEMAPHORE Semaphore, LONG Count, LONG Limit )
1443 FIXME( "(%p %d %d) stub\n", Semaphore , Count, Limit );
1447 /***********************************************************************
1448 * KeInitializeSpinLock (NTOSKRNL.EXE.@)
1450 void WINAPI KeInitializeSpinLock( PKSPIN_LOCK SpinLock )
1452 FIXME( "stub: %p\n", SpinLock );
1456 /***********************************************************************
1457 * KeInitializeTimerEx (NTOSKRNL.EXE.@)
1459 void WINAPI KeInitializeTimerEx( PKTIMER Timer, TIMER_TYPE Type )
1461 FIXME( "stub: %p %d\n", Timer, Type );
1465 /***********************************************************************
1466 * KeInitializeTimer (NTOSKRNL.EXE.@)
1468 void WINAPI KeInitializeTimer( PKTIMER Timer )
1470 KeInitializeTimerEx(Timer, NotificationTimer);
1473 /***********************************************************************
1474 * KeInsertQueue (NTOSKRNL.EXE.@)
1476 LONG WINAPI KeInsertQueue(PRKQUEUE Queue, PLIST_ENTRY Entry)
1478 FIXME( "stub: %p %p\n", Queue, Entry );
1479 return 0;
1482 /**********************************************************************
1483 * KeQueryActiveProcessors (NTOSKRNL.EXE.@)
1485 * Return the active Processors as bitmask
1487 * RETURNS
1488 * active Processors as bitmask
1491 KAFFINITY WINAPI KeQueryActiveProcessors( void )
1493 DWORD_PTR AffinityMask;
1495 GetProcessAffinityMask( GetCurrentProcess(), &AffinityMask, NULL);
1496 return AffinityMask;
1500 /**********************************************************************
1501 * KeQueryInterruptTime (NTOSKRNL.EXE.@)
1503 * Return the interrupt time count
1506 ULONGLONG WINAPI KeQueryInterruptTime( void )
1508 LARGE_INTEGER totaltime;
1510 KeQueryTickCount(&totaltime);
1511 return totaltime.QuadPart;
1515 /***********************************************************************
1516 * KeQuerySystemTime (NTOSKRNL.EXE.@)
1518 void WINAPI KeQuerySystemTime( LARGE_INTEGER *time )
1520 NtQuerySystemTime( time );
1524 /***********************************************************************
1525 * KeQueryTickCount (NTOSKRNL.EXE.@)
1527 void WINAPI KeQueryTickCount( LARGE_INTEGER *count )
1529 count->QuadPart = NtGetTickCount();
1530 /* update the global variable too */
1531 KeTickCount.LowPart = count->u.LowPart;
1532 KeTickCount.High1Time = count->u.HighPart;
1533 KeTickCount.High2Time = count->u.HighPart;
1537 /***********************************************************************
1538 * KeReleaseSemaphore (NTOSKRNL.EXE.@)
1540 LONG WINAPI KeReleaseSemaphore( PRKSEMAPHORE Semaphore, KPRIORITY Increment,
1541 LONG Adjustment, BOOLEAN Wait )
1543 FIXME("(%p %d %d %d) stub\n", Semaphore, Increment, Adjustment, Wait );
1544 return 0;
1548 /***********************************************************************
1549 * KeQueryTimeIncrement (NTOSKRNL.EXE.@)
1551 ULONG WINAPI KeQueryTimeIncrement(void)
1553 return 10000;
1557 /***********************************************************************
1558 * KeResetEvent (NTOSKRNL.EXE.@)
1560 LONG WINAPI KeResetEvent( PRKEVENT Event )
1562 FIXME("(%p): stub\n", Event);
1563 return 0;
1567 /***********************************************************************
1568 * KeSetEvent (NTOSKRNL.EXE.@)
1570 LONG WINAPI KeSetEvent( PRKEVENT Event, KPRIORITY Increment, BOOLEAN Wait )
1572 FIXME("(%p, %d, %d): stub\n", Event, Increment, Wait);
1573 return 0;
1577 /***********************************************************************
1578 * KeSetPriorityThread (NTOSKRNL.EXE.@)
1580 KPRIORITY WINAPI KeSetPriorityThread( PKTHREAD Thread, KPRIORITY Priority )
1582 FIXME("(%p %d)\n", Thread, Priority);
1583 return Priority;
1586 /***********************************************************************
1587 * KeSetSystemAffinityThread (NTOSKRNL.EXE.@)
1589 VOID WINAPI KeSetSystemAffinityThread(KAFFINITY Affinity)
1591 FIXME("(%lx) stub\n", Affinity);
1594 /***********************************************************************
1595 * KeWaitForSingleObject (NTOSKRNL.EXE.@)
1597 NTSTATUS WINAPI KeWaitForSingleObject(PVOID Object,
1598 KWAIT_REASON WaitReason,
1599 KPROCESSOR_MODE WaitMode,
1600 BOOLEAN Alertable,
1601 PLARGE_INTEGER Timeout)
1603 FIXME( "stub: %p, %d, %d, %d, %p\n", Object, WaitReason, WaitMode, Alertable, Timeout );
1604 return STATUS_NOT_IMPLEMENTED;
1607 /***********************************************************************
1608 * IoRegisterFileSystem (NTOSKRNL.EXE.@)
1610 VOID WINAPI IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
1612 FIXME("(%p): stub\n", DeviceObject);
1615 /***********************************************************************
1616 * IoUnregisterFileSystem (NTOSKRNL.EXE.@)
1618 VOID WINAPI IoUnregisterFileSystem(PDEVICE_OBJECT DeviceObject)
1620 FIXME("(%p): stub\n", DeviceObject);
1623 /***********************************************************************
1624 * MmAllocateNonCachedMemory (NTOSKRNL.EXE.@)
1626 PVOID WINAPI MmAllocateNonCachedMemory( SIZE_T size )
1628 TRACE( "%lu\n", size );
1629 return VirtualAlloc( NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE|PAGE_NOCACHE );
1632 /***********************************************************************
1633 * MmAllocateContiguousMemory (NTOSKRNL.EXE.@)
1635 PVOID WINAPI MmAllocateContiguousMemory( SIZE_T size, PHYSICAL_ADDRESS highest_valid_address )
1637 FIXME( "%lu, %s stub\n", size, wine_dbgstr_longlong(highest_valid_address.QuadPart) );
1638 return NULL;
1641 /***********************************************************************
1642 * MmAllocateContiguousMemorySpecifyCache (NTOSKRNL.EXE.@)
1644 PVOID WINAPI MmAllocateContiguousMemorySpecifyCache( SIZE_T size,
1645 PHYSICAL_ADDRESS lowest_valid_address,
1646 PHYSICAL_ADDRESS highest_valid_address,
1647 PHYSICAL_ADDRESS BoundaryAddressMultiple,
1648 MEMORY_CACHING_TYPE CacheType )
1650 FIXME(": stub\n");
1651 return NULL;
1654 /***********************************************************************
1655 * MmAllocatePagesForMdl (NTOSKRNL.EXE.@)
1657 PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS lowaddress, PHYSICAL_ADDRESS highaddress,
1658 PHYSICAL_ADDRESS skipbytes, SIZE_T size)
1660 FIXME("%s %s %s %lu: stub\n", wine_dbgstr_longlong(lowaddress.QuadPart), wine_dbgstr_longlong(highaddress.QuadPart),
1661 wine_dbgstr_longlong(skipbytes.QuadPart), size);
1662 return NULL;
1665 /***********************************************************************
1666 * MmFreeNonCachedMemory (NTOSKRNL.EXE.@)
1668 void WINAPI MmFreeNonCachedMemory( void *addr, SIZE_T size )
1670 TRACE( "%p %lu\n", addr, size );
1671 VirtualFree( addr, 0, MEM_RELEASE );
1674 /***********************************************************************
1675 * MmIsAddressValid (NTOSKRNL.EXE.@)
1677 * Check if the process can access the virtual address without a pagefault
1679 * PARAMS
1680 * VirtualAddress [I] Address to check
1682 * RETURNS
1683 * Failure: FALSE
1684 * Success: TRUE (Accessing the Address works without a Pagefault)
1687 BOOLEAN WINAPI MmIsAddressValid(PVOID VirtualAddress)
1689 TRACE("(%p)\n", VirtualAddress);
1690 return !IsBadWritePtr(VirtualAddress, 1);
1693 /***********************************************************************
1694 * MmMapIoSpace (NTOSKRNL.EXE.@)
1696 PVOID WINAPI MmMapIoSpace( PHYSICAL_ADDRESS PhysicalAddress, DWORD NumberOfBytes, DWORD CacheType )
1698 FIXME( "stub: 0x%08x%08x, %d, %d\n", PhysicalAddress.u.HighPart, PhysicalAddress.u.LowPart, NumberOfBytes, CacheType );
1699 return NULL;
1703 /***********************************************************************
1704 * MmLockPagableSectionByHandle (NTOSKRNL.EXE.@)
1706 VOID WINAPI MmLockPagableSectionByHandle(PVOID ImageSectionHandle)
1708 FIXME("stub %p\n", ImageSectionHandle);
1711 /***********************************************************************
1712 * MmMapLockedPagesSpecifyCache (NTOSKRNL.EXE.@)
1714 PVOID WINAPI MmMapLockedPagesSpecifyCache(PMDLX MemoryDescriptorList, KPROCESSOR_MODE AccessMode, MEMORY_CACHING_TYPE CacheType,
1715 PVOID BaseAddress, ULONG BugCheckOnFailure, MM_PAGE_PRIORITY Priority)
1717 FIXME("(%p, %u, %u, %p, %u, %u): stub\n", MemoryDescriptorList, AccessMode, CacheType, BaseAddress, BugCheckOnFailure, Priority);
1719 return NULL;
1722 /***********************************************************************
1723 * MmUnlockPagableImageSection (NTOSKRNL.EXE.@)
1725 VOID WINAPI MmUnlockPagableImageSection(PVOID ImageSectionHandle)
1727 FIXME("stub %p\n", ImageSectionHandle);
1730 /***********************************************************************
1731 * MmPageEntireDriver (NTOSKRNL.EXE.@)
1733 PVOID WINAPI MmPageEntireDriver(PVOID AddrInSection)
1735 TRACE("%p\n", AddrInSection);
1736 return AddrInSection;
1740 /***********************************************************************
1741 * MmProbeAndLockPages (NTOSKRNL.EXE.@)
1743 void WINAPI MmProbeAndLockPages(PMDLX MemoryDescriptorList, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation)
1745 FIXME("(%p, %u, %u): stub\n", MemoryDescriptorList, AccessMode, Operation);
1749 /***********************************************************************
1750 * MmResetDriverPaging (NTOSKRNL.EXE.@)
1752 void WINAPI MmResetDriverPaging(PVOID AddrInSection)
1754 TRACE("%p\n", AddrInSection);
1758 /***********************************************************************
1759 * MmUnlockPages (NTOSKRNL.EXE.@)
1761 void WINAPI MmUnlockPages(PMDLX MemoryDescriptorList)
1763 FIXME("(%p): stub\n", MemoryDescriptorList);
1767 /***********************************************************************
1768 * MmUnmapIoSpace (NTOSKRNL.EXE.@)
1770 VOID WINAPI MmUnmapIoSpace( PVOID BaseAddress, SIZE_T NumberOfBytes )
1772 FIXME( "stub: %p, %lu\n", BaseAddress, NumberOfBytes );
1775 /***********************************************************************
1776 * ObfReferenceObject (NTOSKRNL.EXE.@)
1778 VOID WINAPI ObfReferenceObject(PVOID Object)
1780 FIXME("(%p): stub\n", Object);
1783 /***********************************************************************
1784 * ObReferenceObjectByHandle (NTOSKRNL.EXE.@)
1786 NTSTATUS WINAPI ObReferenceObjectByHandle( HANDLE obj, ACCESS_MASK access,
1787 POBJECT_TYPE type,
1788 KPROCESSOR_MODE mode, PVOID* ptr,
1789 POBJECT_HANDLE_INFORMATION info)
1791 FIXME( "stub: %p %x %p %d %p %p\n", obj, access, type, mode, ptr, info);
1792 return STATUS_NOT_IMPLEMENTED;
1795 /***********************************************************************
1796 * ObReferenceObjectByName (NTOSKRNL.EXE.@)
1798 NTSTATUS WINAPI ObReferenceObjectByName( UNICODE_STRING *ObjectName,
1799 ULONG Attributes,
1800 ACCESS_STATE *AccessState,
1801 ACCESS_MASK DesiredAccess,
1802 POBJECT_TYPE ObjectType,
1803 KPROCESSOR_MODE AccessMode,
1804 void *ParseContext,
1805 void **Object)
1807 FIXME("stub\n");
1808 return STATUS_NOT_IMPLEMENTED;
1811 /***********************************************************************
1812 * ObfDereferenceObject (NTOSKRNL.EXE.@)
1814 #ifdef DEFINE_FASTCALL1_ENTRYPOINT
1815 DEFINE_FASTCALL1_ENTRYPOINT( ObfDereferenceObject )
1816 void WINAPI __regs_ObfDereferenceObject( VOID *obj )
1817 #else
1818 void WINAPI ObfDereferenceObject( VOID *obj )
1819 #endif
1821 FIXME( "stub: %p\n", obj );
1825 /***********************************************************************
1826 * PsCreateSystemThread (NTOSKRNL.EXE.@)
1828 NTSTATUS WINAPI PsCreateSystemThread(PHANDLE ThreadHandle, ULONG DesiredAccess,
1829 POBJECT_ATTRIBUTES ObjectAttributes,
1830 HANDLE ProcessHandle, PCLIENT_ID ClientId,
1831 PKSTART_ROUTINE StartRoutine, PVOID StartContext)
1833 if (!ProcessHandle) ProcessHandle = GetCurrentProcess();
1834 return RtlCreateUserThread(ProcessHandle, 0, FALSE, 0, 0,
1835 0, StartRoutine, StartContext,
1836 ThreadHandle, ClientId);
1839 /***********************************************************************
1840 * PsGetCurrentProcessId (NTOSKRNL.EXE.@)
1842 HANDLE WINAPI PsGetCurrentProcessId(void)
1844 if (GetCurrentThreadId() == request_thread)
1845 return UlongToHandle(client_pid);
1846 return UlongToHandle(GetCurrentProcessId());
1850 /***********************************************************************
1851 * PsGetCurrentThreadId (NTOSKRNL.EXE.@)
1853 HANDLE WINAPI PsGetCurrentThreadId(void)
1855 if (GetCurrentThreadId() == request_thread)
1856 return UlongToHandle(client_tid);
1857 return UlongToHandle(GetCurrentThreadId());
1861 /***********************************************************************
1862 * PsGetVersion (NTOSKRNL.EXE.@)
1864 BOOLEAN WINAPI PsGetVersion(ULONG *major, ULONG *minor, ULONG *build, UNICODE_STRING *version )
1866 RTL_OSVERSIONINFOEXW info;
1868 info.dwOSVersionInfoSize = sizeof(info);
1869 RtlGetVersion( &info );
1870 if (major) *major = info.dwMajorVersion;
1871 if (minor) *minor = info.dwMinorVersion;
1872 if (build) *build = info.dwBuildNumber;
1874 if (version)
1876 #if 0 /* FIXME: GameGuard passes an uninitialized pointer in version->Buffer */
1877 size_t len = min( strlenW(info.szCSDVersion)*sizeof(WCHAR), version->MaximumLength );
1878 memcpy( version->Buffer, info.szCSDVersion, len );
1879 if (len < version->MaximumLength) version->Buffer[len / sizeof(WCHAR)] = 0;
1880 version->Length = len;
1881 #endif
1883 return TRUE;
1887 /***********************************************************************
1888 * PsImpersonateClient (NTOSKRNL.EXE.@)
1890 NTSTATUS WINAPI PsImpersonateClient(PETHREAD Thread, PACCESS_TOKEN Token, BOOLEAN CopyOnOpen,
1891 BOOLEAN EffectiveOnly, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1893 FIXME("(%p, %p, %u, %u, %u): stub\n", Thread, Token, CopyOnOpen, EffectiveOnly, ImpersonationLevel);
1895 return STATUS_NOT_IMPLEMENTED;
1899 /***********************************************************************
1900 * PsSetCreateProcessNotifyRoutine (NTOSKRNL.EXE.@)
1902 NTSTATUS WINAPI PsSetCreateProcessNotifyRoutine( PCREATE_PROCESS_NOTIFY_ROUTINE callback, BOOLEAN remove )
1904 FIXME( "stub: %p %d\n", callback, remove );
1905 return STATUS_SUCCESS;
1909 /***********************************************************************
1910 * PsSetCreateThreadNotifyRoutine (NTOSKRNL.EXE.@)
1912 NTSTATUS WINAPI PsSetCreateThreadNotifyRoutine( PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine )
1914 FIXME( "stub: %p\n", NotifyRoutine );
1915 return STATUS_SUCCESS;
1919 /***********************************************************************
1920 * PsTerminateSystemThread (NTOSKRNL.EXE.@)
1922 NTSTATUS WINAPI PsTerminateSystemThread(NTSTATUS ExitStatus)
1924 FIXME( "stub: %u\n", ExitStatus );
1925 return STATUS_NOT_IMPLEMENTED;
1929 /***********************************************************************
1930 * MmGetSystemRoutineAddress (NTOSKRNL.EXE.@)
1932 PVOID WINAPI MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName)
1934 HMODULE hMod;
1935 STRING routineNameA;
1936 PVOID pFunc = NULL;
1938 static const WCHAR ntoskrnlW[] = {'n','t','o','s','k','r','n','l','.','e','x','e',0};
1939 static const WCHAR halW[] = {'h','a','l','.','d','l','l',0};
1941 if (!SystemRoutineName) return NULL;
1943 if (RtlUnicodeStringToAnsiString( &routineNameA, SystemRoutineName, TRUE ) == STATUS_SUCCESS)
1945 /* We only support functions exported from ntoskrnl.exe or hal.dll */
1946 hMod = GetModuleHandleW( ntoskrnlW );
1947 pFunc = GetProcAddress( hMod, routineNameA.Buffer );
1948 if (!pFunc)
1950 hMod = GetModuleHandleW( halW );
1951 if (hMod) pFunc = GetProcAddress( hMod, routineNameA.Buffer );
1953 RtlFreeAnsiString( &routineNameA );
1956 if (pFunc)
1957 TRACE( "%s -> %p\n", debugstr_us(SystemRoutineName), pFunc );
1958 else
1959 FIXME( "%s not found\n", debugstr_us(SystemRoutineName) );
1960 return pFunc;
1964 /***********************************************************************
1965 * MmQuerySystemSize (NTOSKRNL.EXE.@)
1967 MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void)
1969 FIXME("stub\n");
1970 return MmLargeSystem;
1973 /***********************************************************************
1974 * KeInitializeDpc (NTOSKRNL.EXE.@)
1976 VOID WINAPI KeInitializeDpc(PRKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine, PVOID DeferredContext)
1978 FIXME("stub\n");
1981 /***********************************************************************
1982 * READ_REGISTER_BUFFER_UCHAR (NTOSKRNL.EXE.@)
1984 VOID WINAPI READ_REGISTER_BUFFER_UCHAR(PUCHAR Register, PUCHAR Buffer, ULONG Count)
1986 FIXME("stub\n");
1989 /*****************************************************
1990 * PoSetPowerState (NTOSKRNL.EXE.@)
1992 POWER_STATE WINAPI PoSetPowerState(PDEVICE_OBJECT DeviceObject, POWER_STATE_TYPE Type, POWER_STATE State)
1994 FIXME("(%p %u %u) stub\n", DeviceObject, Type, State.DeviceState);
1995 return State;
1998 /*****************************************************
1999 * IoWMIRegistrationControl (NTOSKRNL.EXE.@)
2001 NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT DeviceObject, ULONG Action)
2003 FIXME("(%p %u) stub\n", DeviceObject, Action);
2004 return STATUS_SUCCESS;
2007 /*****************************************************
2008 * PsSetLoadImageNotifyRoutine (NTOSKRNL.EXE.@)
2010 NTSTATUS WINAPI PsSetLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE routine)
2012 FIXME("(%p) stub\n", routine);
2013 return STATUS_SUCCESS;
2016 /*****************************************************
2017 * PsLookupProcessByProcessId (NTOSKRNL.EXE.@)
2019 NTSTATUS WINAPI PsLookupProcessByProcessId(HANDLE processid, PEPROCESS *process)
2021 static int once;
2022 if (!once++) FIXME("(%p %p) stub\n", processid, process);
2023 return STATUS_NOT_IMPLEMENTED;
2027 /*****************************************************
2028 * IoSetThreadHardErrorMode (NTOSKRNL.EXE.@)
2030 BOOLEAN WINAPI IoSetThreadHardErrorMode(BOOLEAN EnableHardErrors)
2032 FIXME("stub\n");
2033 return FALSE;
2037 /*****************************************************
2038 * IoInitializeRemoveLockEx (NTOSKRNL.EXE.@)
2040 VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK lock, ULONG tag,
2041 ULONG maxmin, ULONG high, ULONG size)
2043 FIXME("(%p %u %u %u %u) stub\n", lock, tag, maxmin, high, size);
2047 /*****************************************************
2048 * IoAcquireRemoveLockEx (NTOSKRNL.EXE.@)
2051 NTSTATUS WINAPI IoAcquireRemoveLockEx(PIO_REMOVE_LOCK lock, PVOID tag,
2052 LPCSTR file, ULONG line, ULONG lock_size)
2054 FIXME("(%p, %p, %s, %u, %u): stub\n", lock, tag, debugstr_a(file), line, lock_size);
2056 return STATUS_NOT_IMPLEMENTED;
2060 /*****************************************************
2061 * DllMain
2063 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
2065 static void *handler;
2066 LARGE_INTEGER count;
2068 switch(reason)
2070 case DLL_PROCESS_ATTACH:
2071 DisableThreadLibraryCalls( inst );
2072 #ifdef __i386__
2073 handler = RtlAddVectoredExceptionHandler( TRUE, vectored_handler );
2074 #endif
2075 KeQueryTickCount( &count ); /* initialize the global KeTickCount */
2076 break;
2077 case DLL_PROCESS_DETACH:
2078 if (reserved) break;
2079 RtlRemoveVectoredExceptionHandler( handler );
2080 break;
2082 return TRUE;
2085 /*****************************************************
2086 * Ke386IoSetAccessProcess (NTOSKRNL.EXE.@)
2088 BOOLEAN WINAPI Ke386IoSetAccessProcess(PEPROCESS *process, ULONG flag)
2090 FIXME("(%p %d) stub\n", process, flag);
2091 return FALSE;
2094 /*****************************************************
2095 * Ke386SetIoAccessMap (NTOSKRNL.EXE.@)
2097 BOOLEAN WINAPI Ke386SetIoAccessMap(ULONG flag, PVOID buffer)
2099 FIXME("(%d %p) stub\n", flag, buffer);
2100 return FALSE;
2103 /*****************************************************
2104 * IoCreateSynchronizationEvent (NTOSKRNL.EXE.@)
2106 PKEVENT WINAPI IoCreateSynchronizationEvent(PUNICODE_STRING name, PHANDLE handle)
2108 FIXME("(%p %p) stub\n", name, handle);
2109 return NULL;
2112 /*****************************************************
2113 * IoStartNextPacket (NTOSKRNL.EXE.@)
2115 VOID WINAPI IoStartNextPacket(PDEVICE_OBJECT deviceobject, BOOLEAN cancelable)
2117 FIXME("(%p %d) stub\n", deviceobject, cancelable);
2120 /*****************************************************
2121 * ObQueryNameString (NTOSKRNL.EXE.@)
2123 NTSTATUS WINAPI ObQueryNameString(PVOID object, POBJECT_NAME_INFORMATION name, ULONG maxlength, PULONG returnlength)
2125 FIXME("(%p %p %u %p) stub\n", object, name, maxlength, returnlength);
2126 return STATUS_NOT_IMPLEMENTED;
2129 /*****************************************************
2130 * IoRegisterPlugPlayNotification (NTOSKRNL.EXE.@)
2132 NTSTATUS WINAPI IoRegisterPlugPlayNotification(IO_NOTIFICATION_EVENT_CATEGORY category, ULONG flags, PVOID data,
2133 PDRIVER_OBJECT driver, PDRIVER_NOTIFICATION_CALLBACK_ROUTINE callback,
2134 PVOID context, PVOID *notification)
2136 FIXME("(%u %u %p %p %p %p %p) stub\n", category, flags, data, driver, callback, context, notification);
2137 return STATUS_SUCCESS;
2140 /*****************************************************
2141 * IoCsqInitialize (NTOSKRNL.EXE.@)
2143 NTSTATUS WINAPI IoCsqInitialize(PIO_CSQ csq, PIO_CSQ_INSERT_IRP insert_irp, PIO_CSQ_REMOVE_IRP remove_irp,
2144 PIO_CSQ_PEEK_NEXT_IRP peek_irp, PIO_CSQ_ACQUIRE_LOCK acquire_lock,
2145 PIO_CSQ_RELEASE_LOCK release_lock, PIO_CSQ_COMPLETE_CANCELED_IRP complete_irp)
2147 FIXME("(%p %p %p %p %p %p %p) stub\n",
2148 csq, insert_irp, remove_irp, peek_irp, acquire_lock, release_lock, complete_irp);
2149 return STATUS_SUCCESS;
2152 /*****************************************************
2153 * ExInterlockedRemoveHeadList (NTOSKRNL.EXE.@)
2155 PLIST_ENTRY WINAPI ExInterlockedRemoveHeadList(PLIST_ENTRY head, PKSPIN_LOCK lock)
2157 FIXME("(%p %p) stub\n", head, lock);
2158 return NULL;
2161 /***********************************************************************
2162 * ExfInterlockedRemoveHeadList (NTOSKRNL.EXE.@)
2164 #ifdef DEFINE_FASTCALL2_ENTRYPOINT
2165 DEFINE_FASTCALL2_ENTRYPOINT( ExfInterlockedRemoveHeadList )
2166 PLIST_ENTRY WINAPI __regs_ExfInterlockedRemoveHeadList(PLIST_ENTRY head, PKSPIN_LOCK lock)
2167 #else
2168 PLIST_ENTRY WINAPI ExfInterlockedRemoveHeadList(PLIST_ENTRY head, PKSPIN_LOCK lock)
2169 #endif
2171 FIXME("(%p %p) stub\n", head, lock);
2172 return ExInterlockedRemoveHeadList( head, lock );