Commit graph

22313 commits

Author SHA1 Message Date
KJK::Hyperion 182b4dc71d <intrin.h> compatibility header. Implements Visual C++ intrinsics in GCC. Licensed very liberally, please keep it that way
svn path=/trunk/; revision=24098
2006-09-13 14:07:41 +00:00
Saveliy Tretiakov 457e0142bd Move IntGdiGradientFill and IntSystemParametersInfo prototypes to header files.
Delete DestroyThreadWindows prototype (function does not exist).


svn path=/trunk/; revision=24097
2006-09-13 13:43:39 +00:00
Saveliy Tretiakov 0eabb5d7bc Move UserDrawIconEx and UserGetCurIconObject prototyepes to header file.
svn path=/trunk/; revision=24096
2006-09-13 13:03:17 +00:00
Saveliy Tretiakov e6c1f9ca4b Add UnattendSetupEnabled key for enabling\disabling unattended setup without editing rbuild files.
Modifing rbuild files all the time is not handy and slows down build process.


svn path=/trunk/; revision=24095
2006-09-13 12:33:59 +00:00
Alex Ionescu 63142230b2 - Rename kqueue.c to devque. KQUEUE (kernel queues) are implemented in queue.c, and this filename always confused me. Why would you name KDEVICE_QUEUE into kqueue.c, when you already have KQUEUE in queue.c?!
- Rename exception.c to except.c, mostly due to MSVC's incompatibility with multiple identically named files.
- SVN delete usercall.c leftover.
- Fix KeSetPriorityAndQuantumProcess to use Queued Spinlocks and KiAcquireProcess/ThreadLock when needed.

svn path=/trunk/; revision=24094
2006-09-13 03:02:40 +00:00
Alex Ionescu 630f3d1e69 - Cleanup ipi.c, reformat, and re-organize.
- Undefine all functions for UP builds, except KeIpiGenericCall.
- Implement KeIpiGenericCall for UP builds and add @implemented tag.

svn path=/trunk/; revision=24093
2006-09-13 02:25:32 +00:00
Alex Ionescu 31e4c651c4 - Renamed device.c to config.c and removed all irrelevant code from it, leaving only the two KeFindConfigurationEntry*** functions in it.
- Also fixed the above for incorrect formatting/excessive whitespace.
- The other routines in device.c were moved to cpu.c, since they deal with CPU-specific things.
- Cleaned up KeFlushEntireTb.
- Added inlined routines for setting/getting CR, and also getting GDTR, IDTR, LDTR, TR. Used to implement KiSaveProcessorControlState.
- Implemented KeSaveStateForHibernate.

svn path=/trunk/; revision=24092
2006-09-13 02:08:22 +00:00
Alex Ionescu b4aab80937 - Fix a typo that happened after-the-fact.
svn path=/trunk/; revision=24091
2006-09-13 02:04:33 +00:00
Alex Ionescu 7687187bf0 - Implement KxAcquireSpinLock/KxReleaseSpinLock for inline acquisition of spinlocks, SMP, UP and DBG. (on DBG builds, we OR the spinlock value with the KTHREAD address, then compare on release.)
- Make In-Stack QSLs a complete no-op in UP, we were still touching some fields.
- Cleanup and re-organize spinlock.c

svn path=/trunk/; revision=24090
2006-09-13 01:41:17 +00:00
Alex Ionescu 07a0973e21 - Remove usercall.c from portable part of Ke and add it to ke\i386. The implementation is slightly arch-specific.
- Remove code in userapc.c and move it into usercall.c, since both functions basically deal with user-mode callouts.
- Handle STATUS_CALLBACK_POP_STACK and add the status to ntstatus.h
- Also handle future support for GDI Batch flushing.

svn path=/trunk/; revision=24089
2006-09-13 01:00:50 +00:00
Alex Ionescu a614833b08 - Use inlined guarded region routines instead of duplicating code.
- Add @implemented tags.

svn path=/trunk/; revision=24088
2006-09-13 00:35:56 +00:00
Alex Ionescu d99f96a295 - Implement KiAcquireDeviceQueueLock/KiReleaseDeviceQueueLock for locking KDEVICE_QUEUEs, since they can be used from Threaded DPCs which don't execute at DISPATCH_LEVEL, so the lock needs to be acquired differently.
- Add ASSERT_DEVICE_QUEUE and ASSERTify + reformat kqueue.c.
- Implement KeRemoveByKeyDeviceQueueIfBusy.
- Cleanup exception.c
- Remove dangerous/broken KeGetCurrentIrql() define.

svn path=/trunk/; revision=24087
2006-09-13 00:20:46 +00:00
Aleksey Bragin c0cda24302 Just one entrypoint="0" is enough
svn path=/trunk/; revision=24086
2006-09-12 21:33:56 +00:00
Hervé Poussineau 6ed6c1661e Don't call notification procedures with APC disabled, it may lead to some strange results.
Thanks Alex for the time he took to help me to debug this issue

svn path=/trunk/; revision=24085
2006-09-12 21:18:22 +00:00
Ged Murphy 3fd92a4f96 Revert changes from r23620 until a better solution can be found as it breaks opening of cpl applets with VS.
The 'DebugSettings' should be stored in the .user file.

svn path=/trunk/; revision=24084
2006-09-12 21:02:39 +00:00
Aleksey Bragin 3b58ac1932 Fix last things preventing me from compiling the tree:
vsnprintt -> _vsnprintf in the wine/unicode.h and in riched20

svn path=/trunk/; revision=24083
2006-09-12 18:51:05 +00:00
Hervé Poussineau 2140d54ca5 Start to support GUID_DEVICE_SYS_BUTTON interface. It is required to handle keyboards with power buttons (wake/sleep/power)
(This commit is done now to be able to debug an APC problem)

svn path=/trunk/; revision=24082
2006-09-12 15:19:51 +00:00
Hervé Poussineau fec5904b50 [AUDIT] This file only include other files, so it can't be dirty.
Additionally, define GUID_DEVICE_SYS_BUTTON

svn path=/trunk/; revision=24081
2006-09-12 15:19:17 +00:00
Alex Ionescu 2829cc5982 - Re-merge 24062+24063, with a minor difference, they work now.
svn path=/trunk/; revision=24080
2006-09-12 13:54:52 +00:00
Alex Ionescu 6b1e4db5b5 - Partial revert of r20462/63. New HAL/Po/Ki code remains, but restored the original PsIdleThread code. I know what the bug is but I'm too tired to fix it, so I'd rather revert the broken part.
- Install + 2nd stage + boot to desktop will not work in qemu, kernel-kqemu and vmware (all wax and I tested).

svn path=/trunk/; revision=24079
2006-09-12 05:37:14 +00:00
Alex Ionescu 978da5c0af - Revert 24020 (good code, but buggy) and 24041 (bad code/revision).
- This gets us as far as 24061(+24048) for booting.

svn path=/trunk/; revision=24078
2006-09-12 05:21:27 +00:00
Aleksey Bragin 4e03e0ec4a Those two #ifdefs were wrong on my setup (straightforward RosBE 3.4.2, and also updated to 3.4.4). So:
1. Removed the stricmp guard
2. Added a #ifdef->#undef solution

If this break compilation on linux or on gcc 4 on win32 (very low probability, if any), let's think further.

svn path=/trunk/; revision=24076
2006-09-11 21:40:50 +00:00
Saveliy Tretiakov 17189649af For windows with WS_EX_DLGMODALFRAME sysmenu can be opened only by right mouse click
svn path=/trunk/; revision=24074
2006-09-11 15:49:42 +00:00
Hervé Poussineau 6f5c6f23d3 Fix halmp compilation
svn path=/trunk/; revision=24073
2006-09-11 14:35:46 +00:00
Saveliy Tretiakov 68f5e47ce6 This testapp demonstrates WS_SYSMENU + WS_EX_DLGMODALFRAME behavior
and shows that DrawCaption does care about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW.


svn path=/trunk/; revision=24072
2006-09-11 13:09:12 +00:00
Saveliy Tretiakov 529631027a Fix WS_SYSMENU+WS_EX_DLGMODALFRAME bug.
Fixes Messagebox broblem and some others.

svn path=/trunk/; revision=24071
2006-09-11 13:07:12 +00:00
Aleksey Bragin d263039fe9 Add missing header
svn path=/trunk/; revision=24070
2006-09-11 13:01:39 +00:00
Hervé Poussineau 60fb482ad4 Fix compilation on Linux hosts - try #2
We can't use the _WIN32 symbol which is automatically defined once you include psdk/windef.h ...

svn path=/trunk/; revision=24069
2006-09-11 12:42:35 +00:00
Alex Ionescu 5fb31962db - Implement KiReleaseProcessLockFromDpcLevel and use it in KeTerminateThread. We were lowering to PASSIVE during thread termination, and then doing a context switch at PASSIVE, which you can guess is pretty bad.
svn path=/trunk/; revision=24068
2006-09-11 12:00:02 +00:00
Hervé Poussineau 07dc58982f We want to support hives version 1.3+ (up to 1.5 currently). Fix test accordingly
svn path=/trunk/; revision=24067
2006-09-11 11:28:54 +00:00
Hervé Poussineau 7b79f44d6b Better handling of REG_LINK values
Try to fix Linux build (thanks Usurp on IRC)

svn path=/trunk/; revision=24066
2006-09-11 11:04:33 +00:00
Saveliy Tretiakov 4f6a751b6f Implement NtGdiCloseFigure (Fixes BSOD!)
svn path=/trunk/; revision=24065
2006-09-11 11:01:35 +00:00
Saveliy Tretiakov 059fb2c54e Implement NtGdiFlattenPath
svn path=/trunk/; revision=24064
2006-09-11 10:43:42 +00:00
Alex Ionescu c19a362969 - Implement HalProcessorIdle.
- Fix KiIdleLoop to actuall load the PCR in EBX. It was using a completely random value.
- Call the Processor Idle Routine now, isntead of hard-coding STI+HLT. This routine had already been setup during bootup by PoInitailizePrcb.
- Implemented PopIdle0 and made it call HalProcessorIdle. No performance/throttling is done yet.

svn path=/trunk/; revision=24063
2006-09-11 06:50:19 +00:00
Alex Ionescu 81997fc0bc - Implement and export HalClearSoftawareInterrupt (currently implemented to match the hacked ROS version, no new version written yet).
- Implement CPU Idle Loop in assembly for UP and SMP systems. Differences:
  * Runs with interrupts off most of the time, except when it does interrupt cycling at each iteration.
  * Calls KiRetireDpcList directly, instead of going through KiDispatchInterrupt.
  * Support for new scheduler and immediate thread switch.
  * Support for Idle Scheduler.
  * Support for HAL/ACPI/CPU Driver-defined "Idle Function". currently disabled and STI+HLT harcoded instead.
- Removed ps/idle.c and dumped the hack code directly in psmgr.c wher eit's used.

svn path=/trunk/; revision=24062
2006-09-11 06:22:26 +00:00
Alex Ionescu a0fac81cfd - Add the actual missing code to KiQuantumEnd. It's asserted to make sure it'll never execute (yet).
- Add KiExitDispatcher from my new scheduler code. Same as KiQuantumEnd, added an assertion to make sure it doesn't enter in code paths that shouldn't yet happen.

svn path=/trunk/; revision=24061
2006-09-11 05:26:38 +00:00
Alex Ionescu 6c853c9c32 - Fix a critical bug in KiComputeNewPriority.
- Fix a bug in KiSetPriorityThread which wasn't setting *released = FALSE, which left the var uninitailized and usually = TRUE on the stack.
- Half-copy KiQuantumEnd from my new scheduler code. Main difference is usage of newly created locks, support for quantum-disable and RT threads, and usage of KiComputeNewPriority.

svn path=/trunk/; revision=24060
2006-09-11 05:21:18 +00:00
Alex Ionescu 8028be67cb - Fix KiDeliverApc prototype for PPC compatibilty.
- Fixup comment header for KiDeliverApc and KiInsertQueueApc.
- Set APC trap frame during APC delivery. We actually weren't doing this before (I'm kind of amazed at ROS's previous functionality due to importance of this bug!).
- Use proper in-stack queued spinlock mechanisms.
- Make sure that the Kernel APC list didn't become empty while we acquired the APC lock after the first verification.
- Validate IRQL on return from APC routines, to catch bad code.

svn path=/trunk/; revision=24059
2006-09-11 04:34:25 +00:00
Alex Ionescu d011801cef - Fix lock acquisition/release mismathces in KiInsertQueueApc.
- Support and document InsertApcEnvironment KAPC_ENVIRONMENT type.
- Fixup formatting and ASSERTify.
- Acquire dispatcher lock when insereting an APC into another thread.
- Use delayed interrupt request on SMP systems (and fixup KiRequestApcInterrupt accordingly).

svn path=/trunk/; revision=24058
2006-09-11 03:14:26 +00:00
Alex Ionescu 52b3dfb608 - Fix stupid typo.
svn path=/trunk/; revision=24057
2006-09-11 02:30:38 +00:00
Alex Ionescu 90a7bca112 - Add new KAPC_ENVIRONMENT mode: InsertApcEnvironment.
- Fixup KeInitalizeApc like all the other functions.
- Don't use an expensive 48-byte RtlZeroMemory instead of just clearing two members.

svn path=/trunk/; revision=24056
2006-09-11 02:28:09 +00:00
Alex Ionescu 8b90aed6be - Fix comment headers for KeFlushQueueApc, KeInsertQueueApc.
- ASSERTify KeInsertQueueApc and some formatting fixes.

svn path=/trunk/; revision=24055
2006-09-11 02:17:57 +00:00
Alex Ionescu c9607ffe89 - Fix for Windows Kernel APC Data-Free Local Privilege Escalation Vulnerability (re-initialize the list head after cleaning it, so that the list is circular).
- Optimize KeFlushQueueApc: we can check if the Kernel-Mode APC list is empty without acquiring the lock. If it's empty, we can quit immediately, if not, then we'll acquire and check it again. For user APCs we always need to acquire the lock, though.

svn path=/trunk/; revision=24054
2006-09-11 02:09:13 +00:00
Alex Ionescu 43a412db60 - Add ASSERT_APC definition.
- Fix KeRemoveQueueApc comment header and clean up function.
- Acquire dispatcher lock at DPC level during ApcListEntry read/write.

svn path=/trunk/; revision=24053
2006-09-11 01:45:11 +00:00
Alex Ionescu 4b35027c0f - Cleanup RepairList, KiMoveApcState.
- Fixup comments for KeAreApcsDisabled.
- Implement and add comment header to KeAreAllApcsDisabled.

svn path=/trunk/; revision=24052
2006-09-11 01:30:24 +00:00
Alex Ionescu 2fea34f0e1 - Re-implement KiRequestApcInterrupt in ke_x.h. Make it work by CPU number (as documented) instead of comparing PRCBs.
- Move NtQueueApcThread to ps/state.c since it's a Ps-level function.
- Make NtQueueApcThread use POOL_QUOTA_FAIL_INSTEAD_OF_RAISE and add that flag to our DDK. Also fix the check for SystemThread by looking at the flag, not checking if TEB == NULL. Also fix a memory leak and comment header.
- Fix comment header in KiInitalizeUserApc.

svn path=/trunk/; revision=24051
2006-09-11 01:15:03 +00:00
Alex Ionescu 1462b71058 - Re-organize apc.c into private/public functions (no code change).
- Move KiInitializeUserApc to ke/i386/userapc.c. The routine is non-portable.
- Force Ring 3 state into User APC TrapFrame to maintain system integrity and coherency. Also respect IOPL.
- Use SEH handling routine just like when handling exceptions, to properly re-direct a crash here. Thanks to KJK again for showing me how to write these kinds of routines.

svn path=/trunk/; revision=24050
2006-09-11 00:54:12 +00:00
Alex Ionescu 4d94e0557f - Fix KeEnterCriticalRegion/KeLeaveCriticalRegion by moving to ke_x and adding ASSERTs, and change the code in apc.c to call these inlined versions instead. Also fix comment headers for these functions in apc.c to match the official standard.
svn path=/trunk/; revision=24049
2006-09-11 00:26:17 +00:00
Alex Ionescu 38759195cb - We only need to update the page directory for the current stack, not the whole ETHREAD. (the page fault will be handled).
- Release dispatcher lock from DPC level in KiAttachProcess.
- Add missing decoration/assert to KeAttachProcess, and only acquire APC lock after we've made the invalid attach test. Also acquire dispatcher lock at DPC level here and in KeStackAttachProcess.
- Loop in KeUnStachDetachProcess to avoid the case where we acquired the APC lock while a kernel APC was pending. Keep releaing the loop and re-attemping acquire until it has been delivered.
- Add Decoration for *ServiceTable* functions.

svn path=/trunk/; revision=24048
2006-09-10 23:41:08 +00:00
Alex Ionescu d7ae142cf1 - KPROCSES Flags are LONG, not ULONG.
- Add some missing decoration.
- NUMA node semantics for KeInitializeProcess are only required on SMP builds.
- Allow KeInitailizeProcess to receive an argument specifying if alignment faults should be enabled or not.
- Use KiComputeIopmOffset to get the IopmOFfset instead of setting -1

svn path=/trunk/; revision=24047
2006-09-10 23:17:22 +00:00