[KERNEL32]: Bug: QueryMemoryResourceNotification should set ERROR_INVALID_PARAMETER and fail if the Handle is NULL or INVALID_HANDLE_VALUE.
[KERNEL32]: Fix ULONG<->BOOL cast in QueryMemoryResourceNotification as well.
svn path=/trunk/; revision=52817
[KERNEL32]: SetLastError should only set the error code if it's different from the one already set. This is not about optimization: it's compatibility with hardware data breakpoint behavior.
svn path=/trunk/; revision=52816
Bug: RemoveHandles was checking for process AND thread handle match, instead of OR.
Bug: CloseAllProcessHandles and RemoveHandles's processing loop was buggy with its unlinking and re-use of nested ThreadData.
Bug: ProcessIdToHandle was requesting more process rights than needed.
Bug: Some ULONG<->BOOL conversions were dirty (as in, could result in values of 2 or higher).
Bug: In WaitForDebugEvent, During CREATE_PROCESS_DEBUG_EVENT, the wrong handle was saved as the thread handle.
Bug: In WaitForDebugEvent, all events returned TRUE. Instead, only valid events should return TRUE, and non-existing events should return FALSE.
Add some asserts.
Simplify MarkThreadHandle and MarkProcessHandle.
Simplify OutputDebugStringW.
svn path=/trunk/; revision=52813
- move BaseFiberStartup to fiber.S
- add FPO debug info for MSVC builds
- remove excessive END directives (fixes msvc build)
- add a stub for amd64
svn path=/trunk/; revision=52810
[KERNEL32]: BasepInitializeContext was not creating a correct CONTEXT record for fibers: the stack return address was not set (EIP was being used instead), and support for FPU-compatible Fibers was non-existent.
[KERNEL32]: CreateFiberEx was not passing the correct context flags to BasepInitializeContext to notify it that this is an FPU-fiber.
[KERNEL32]: SwitchToFiber was using some weird "FXSR" constant that maps to checking of PowerPC 64-bit Move instructions are available. We actually want to check for XMMI.
svn path=/trunk/; revision=52809
Bug #50: SwitchToFiber needs to check if FXSR is *NOT* present in order to skip using ldmxcsr/stmxcsr. Previously, it would check if it's unsupported, and jump past the instruction if it was (resulting in invalid opcode instructions on older systems)
50 bugs. Penance has been paid.
svn path=/trunk/; revision=52807
Bug #47: CreateFiberEx should return ERROR_INVALID_PARAMETER for invalid flags.
Bug #48: DeleteFiber should also check if HasFiberData is TRUE in TEB before calling ExitThread.
Bug #49: DeleteFiber should only delete the FIBER data structure after cleanup is complete, not before.
Also, enable the calls to RtlAllocateActivationContextStack since SxS kind-of exists now. However, we leak the context since RtlFreeActivationContextStack is not implemented.
Also, add a call to BaseRundownFls so we don't forget to cleanup FLS data once FLS is implemented.
svn path=/trunk/; revision=52805
Bug #45: ConvertThreadToFiberEx should return ERROR_INVALID_PARAMETER if an invalid flag is passed.
Bug #46: ConvertThreadToFiberEx should return ERROR_ALREADY_FIBER if the thread is already a fiber, not return the current fiber data.
svn path=/trunk/; revision=52804
Bug #43: ConvertFiberToThread should return ERROR_ALREADY_THREAD, not ERROR_INVALID_PARAMETER in case of failure.
Bug #44: ConvertFiberToThread should set FiberData to NULL in the TEB, after doing the conversion.
Thanks, Winetests, for saying "0 failures", when this API was broken.
svn path=/trunk/; revision=52803
Bug #39: BaseThreadStartup needs to call CsrNewThread (which registers the termination port with CSRSS) for Win32 threads.
Bug #40: If a crash happens during thread execution, ExitProcess should be called instead of ExitThread (unless this is a CSR thread).
Bug #41: The ExitThread/Process APIs should be called still from within the context of the SEH frame, not outside of it.
Use BaseRunningInServerProcess global instead of local IsServer local when connecting to CSRSS. This is needed for things such as the above.
svn path=/trunk/; revision=52801
Bug #35: TlsSetValue should allocate the TlsExpansionSlots under the PEB Lock.
Bug #36: TlsGetValue needs to set the last error to ERROR_SUCCESS when the index is valid (amd even if no expansion slots exist!).
Bug #37: TlsFree did not check the return of NtSetInformationThread(ThreadZeroTlsCell).
Bug #38: TlsAlloc was setting error to ERROR_NO_MORE_ITEMS instead of STATUS_NO_MEMORY. In principle the former is more accurate, but that's not how API compatibility works.
Optimize TLS functions not to call NtQueryTeb/Peb all the time. Cache the TEB/PEB value instead.
svn path=/trunk/; revision=52800
[KERNEL32]: Fix bugs #26, #27: RegisterWait(Ex) was not calling GetConsoleInputWaitHandle, so waits on console handles were given straight to the kernel (which obvioulsy doesn't grok them).
[KERNEL32]: Fix bugs #28, #29: UnRegisterWait(Ex) was not checking for STATUS_PENDING, which is a "warning" in NT, but an error as far as this API is concerned, so FALSE should be returned.
svn path=/trunk/; revision=52797
[KERNEL32]: Update Event APIs to use the new macros. Fixes bugs #14, #15: the create/open ANSI APIs were not returning the right error in case of object names that were too large.
svn path=/trunk/; revision=52791
[KERNEL32]: Fix bugs #11, #12, #13: OpenJobObjectA did not correctly set the error code in case the string was too long, nor did it use the TEB's static unicode cache, nor did it enforce a 260 character object name limit. Fixed by using the new macro.
svn path=/trunk/; revision=52789
[KERNEL32]: Fix bugs #7, #8, #9, #10: CreateJobObjectW did not add OBJ_OPENIF to named jobs, it did not add named objects in the BaseNamedObjects directory, it did not correctly set ERROR_ALREADY_EXISTS when collisions happened, and it did not set ERROR_SUCCESS when the object was created. All this was fixed by using the new CreateNtObjectFromWin32Api macro.
svn path=/trunk/; revision=52788
[KERNEL32]: Fix bug #1: CreateFileMappingA was not returning the right error if the file mapping name was too long. By making it use the new ConvertWin32AnsiObjectApiToUnicodeApi macro, it now does.
svn path=/trunk/; revision=52776
[KERNEL32]: And at last, the final stroke. Move toolhelp.c into client, and split time.c into timezone.c (wineisms) and time.c (incorrect/buggy ntisms), which goes into client. Now "misc" truly only contains Wine-code (along with winnls), and the true NT base API that needs to be focused on is in "client".
svn path=/trunk/; revision=52772