From 87def142b643155461971f3196033b522f2a0e14 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 6 Nov 2010 15:38:43 +0000 Subject: [PATCH 001/132] [SPRINTF] - Don't compile the new sprintf by default. Requested by Timo. svn path=/trunk/; revision=49512 --- reactos/config.template.rbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/config.template.rbuild b/reactos/config.template.rbuild index 225850e45da..103c2e98e67 100644 --- a/reactos/config.template.rbuild +++ b/reactos/config.template.rbuild @@ -107,6 +107,6 @@ - + From 49cee181ca76b1ef6ce66cb78c173078825dfaef Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Nov 2010 23:03:22 +0000 Subject: [PATCH 002/132] [CRT] Fix a bug in streamout(), that could cause a buffer overrun and made msvcrt_winetest crash. svn path=/trunk/; revision=49513 --- reactos/lib/sdk/crt/printf/streamout.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index 3deaedad4f5..f1d1b05a7d2 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -551,7 +551,6 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) } while (val64); - while (precision-- > 0) *--string = '0'; len = _tcslen(string); break; @@ -563,7 +562,8 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Calculate padding */ prefixlen = prefix ? _tcslen(prefix) : 0; - padding = fieldwidth - len - prefixlen; + if (precision < 0) precision = 0; + padding = fieldwidth - len - prefixlen - precision; /* Optional left space padding */ if ((flags & (FLAG_ALIGN_LEFT | FLAG_PAD_ZERO)) == 0) @@ -584,13 +584,11 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) } /* Optional left '0' padding */ - if ((flags & (FLAG_ALIGN_LEFT | FLAG_PAD_ZERO)) == FLAG_PAD_ZERO) + if ((flags & FLAG_ALIGN_LEFT) == 0) precision += padding; + while (precision-- > 0) { - while (padding-- > 0) - { - if ((written = streamout_char(stream, _T('0'))) == -1) return -4; - written_all += written; - } + if ((written = streamout_char(stream, _T('0'))) == -1) return -4; + written_all += written; } /* Output the string */ From 2f7608101c9022b7247b0a2d52205076481a874b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 7 Nov 2010 00:59:41 +0000 Subject: [PATCH 003/132] [CRT] In streamout() handle %%, negative fieldwidth and negative precision. svn path=/trunk/; revision=49514 --- reactos/lib/sdk/crt/printf/streamout.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index f1d1b05a7d2..9ea37429710 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -97,7 +97,8 @@ format_float( int num_digits, val32, base = 10; __int64 val64; - if (precision == -1) precision = 6; + if (precision < 0) precision = 6; + else if (precision > 512) precision = 512; fpval = va_arg_ffp(*argptr, flags); exponent = get_exp(fpval); @@ -302,7 +303,15 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Write the character to the stream */ if ((written = streamout_char(stream, chr)) == -1) return -1; written_all += written; - /* Continue with next char */ + continue; + } + + /* Check for escaped % character */ + if (*format == _T('%')) + { + /* Write % to the stream */ + if ((written = streamout_char(stream, _T('%'))) == -1) return -1; + written_all += written; continue; } @@ -323,6 +332,11 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) if (chr == _T('*')) { fieldwidth = va_arg(argptr, int); + if (fieldwidth < 0) + { + flags |= FLAG_ALIGN_LEFT; + fieldwidth = -fieldwidth; + } chr = *format++; } else From 7d0aa25a0f2c4035fa7479972dd26b3f59dc9c48 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 7 Nov 2010 10:06:00 +0000 Subject: [PATCH 004/132] [CRT] In streamout(): fix a number of formatting bugs, round floats, fix issue with large unsigned values that were treated as signed, simplify some code. svn path=/trunk/; revision=49516 --- reactos/lib/sdk/crt/printf/streamout.c | 54 ++++++++++++-------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index 9ea37429710..53bfebafc42 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -145,7 +145,7 @@ format_float( } /* CHECKME: Windows seems to handle a max of 17 digits(?) */ - num_digits = precision <= 17 ? precision : 17; + num_digits = precision <= 17 ? precision: 17; /* Handle sign */ if (fpval < 0) @@ -173,20 +173,19 @@ format_float( } else { - val64 = (__int64)fpval; - fpval -= val64; fpval *= pow(10., precision); + val64 = (__int64)(fpval + 0.5); - while (num_digits--) + while (num_digits-- > 0) { - *--(*string) = digits[(__int64)fpval % 10]; - fpval /= 10; + *--(*string) = digits[val64 % 10]; + val64 /= 10; } } *--(*string) = _T('.'); - /* Gather digits in reverse order */ + /* Digits before the decimal point */ do { *--(*string) = digits[val64 % base]; @@ -286,7 +285,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) int base, len, prefixlen, fieldwidth, precision, padding; int written = 1, written_all = 0; unsigned int flags; - __int64 val64; + unsigned __int64 val64; buffer[BUFFER_SIZE] = '\0'; @@ -297,8 +296,9 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Check for end of format string */ if (chr == _T('\0')) break; - /* Check for 'normal' character */ - if (chr != _T('%')) + /* Check for 'normal' character or double % */ + if ((chr != _T('%')) || + (chr = *format++) == _T('%')) { /* Write the character to the stream */ if ((written = streamout_char(stream, chr)) == -1) return -1; @@ -306,26 +306,17 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) continue; } - /* Check for escaped % character */ - if (*format == _T('%')) - { - /* Write % to the stream */ - if ((written = streamout_char(stream, _T('%'))) == -1) return -1; - written_all += written; - continue; - } - /* Handle flags */ flags = 0; while (1) { - chr = *format++; if (chr == _T('-')) flags |= FLAG_ALIGN_LEFT; else if (chr == _T('+')) flags |= FLAG_FORCE_SIGN; else if (chr == _T(' ')) flags |= FLAG_FORCE_SIGNSP; else if (chr == _T('0')) flags |= FLAG_PAD_ZERO; else if (chr == _T('#')) flags |= FLAG_SPECIAL; else break; + chr = *format++; } /* Handle field width modifier */ @@ -505,13 +496,14 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Use external function, one for kernel one for user mode */ format_float(chr, flags, precision, &string, &prefix, &argptr); len = _tcslen(string); + precision = 0; break; case _T('d'): case _T('i'): - val64 = va_arg_f(argptr, flags); + val64 = (__int64)va_arg_f(argptr, flags); - if (val64 < 0) + if ((__int64)val64 < 0) { val64 = -val64; prefix = _T("-"); @@ -526,12 +518,9 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) case _T('o'): base = 8; if (flags & FLAG_SPECIAL) prefix = _T("0"); + goto case_unsigned; /* Fall through */ - case _T('u'): - val64 = (unsigned __int64)va_arg_fu(argptr, flags); - goto case_number; - case _T('p'): precision = 2 * sizeof(void*); flags &= ~FLAG_PAD_ZERO; @@ -543,27 +532,31 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Fall through */ case _T('x'): - val64 = (unsigned __int64)va_arg_fu(argptr, flags); base = 16; if (flags & FLAG_SPECIAL) { prefix = &digits[16]; } + case _T('u'): + case_unsigned: + val64 = va_arg_fu(argptr, flags); + case_number: #ifdef _UNICODE flags |= FLAG_WIDECHAR; #else flags &= ~FLAG_WIDECHAR; #endif + if (precision < 0) precision = 1; + /* Gather digits in reverse order */ - do + while (val64) { *--string = digits[val64 % base]; val64 /= base; precision--; } - while (val64); len = _tcslen(string); break; @@ -578,11 +571,12 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) prefixlen = prefix ? _tcslen(prefix) : 0; if (precision < 0) precision = 0; padding = fieldwidth - len - prefixlen - precision; + if (padding < 0) padding = 0; /* Optional left space padding */ if ((flags & (FLAG_ALIGN_LEFT | FLAG_PAD_ZERO)) == 0) { - while (padding-- > 0) + for (; padding > 0; padding--) { if ((written = streamout_char(stream, _T(' '))) == -1) return -2; written_all += written; From 58e3fc91d5c905ea9640f97d14490b1cb4f2a5cc Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 8 Nov 2010 00:31:00 +0000 Subject: [PATCH 005/132] [NTOSKRNL] Minor stuff. Here is your commit Timo ;) svn path=/trunk/; revision=49519 --- reactos/ntoskrnl/fsrtl/faulttol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/faulttol.c b/reactos/ntoskrnl/fsrtl/faulttol.c index ca66fab20f4..ea868adbb3e 100644 --- a/reactos/ntoskrnl/fsrtl/faulttol.c +++ b/reactos/ntoskrnl/fsrtl/faulttol.c @@ -17,7 +17,7 @@ /*++ * @name FsRtlBalanceReads - * @implemented NT 4.0 + * @implemented NT 5.2 * * The FsRtlBalanceReads routine sends an IRP to an FTDISK Driver * requesting the driver to balance read requests across a mirror set. @@ -65,6 +65,8 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice) KernelMode, FALSE, NULL); + ASSERT(Status == STATUS_SUCCESS); + /* Return Status */ Status = IoStatusBlock.Status; } @@ -75,7 +77,7 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice) /*++ * @name FsRtlSyncVolumes - * @implemented NT 4.0 + * @implemented NT 5.2 * * The FsRtlSyncVolumes routine is deprecated. * From 77d20c89bf338c1a4327d33fb5a93d5a9dd05752 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Mon, 8 Nov 2010 02:15:53 +0000 Subject: [PATCH 006/132] [NTOS]: Context switch in C instead of ASM. Can be made more portable, but it's a good start. Unless Timo rewrites it. svn path=/trunk/; revision=49520 --- reactos/ntoskrnl/ke/i386/ctxswitch.S | 300 ++------------------------- reactos/ntoskrnl/ke/i386/thrdini.c | 136 ++++++++++++ 2 files changed, 159 insertions(+), 277 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/ctxswitch.S b/reactos/ntoskrnl/ke/i386/ctxswitch.S index 518d05da460..53a7e036dd5 100644 --- a/reactos/ntoskrnl/ke/i386/ctxswitch.S +++ b/reactos/ntoskrnl/ke/i386/ctxswitch.S @@ -40,284 +40,16 @@ .globl @KiSwapContextInternal@0 .func @KiSwapContextInternal@0, @KiSwapContextInternal@0 @KiSwapContextInternal@0: + /* Set APC Bypass Disable and old thread pointer */ + mov edx, edi + or dl, cl - /* Save the IRQL */ - push ecx - -#ifdef CONFIG_SMP -GetSwapLock: - /* Acquire the swap lock */ - cmp byte ptr [esi+KTHREAD_SWAP_BUSY], 0 - jz NotBusy - pause - jmp GetSwapLock -NotBusy: -#endif - /* Increase context switches (use ES for lazy load) */ - inc dword ptr es:[ebx+KPCR_CONTEXT_SWITCHES] - - /* Save the Exception list */ - push [ebx+KPCR_EXCEPTION_LIST] - - /* Check for WMI */ - cmp dword ptr [ebx+KPCR_PERF_GLOBAL_GROUP_MASK], 0 - jnz WmiTrace - -AfterTrace: -#ifdef CONFIG_SMP -#if DBG - /* Assert that we're on the right CPU */ - mov cl, [esi+KTHREAD_NEXT_PROCESSOR] - cmp cl, [ebx+KPCR_PROCESSOR_NUMBER] - jnz WrongCpu -#endif -#endif - - /* Get CR0 and save it */ - mov ebp, cr0 - mov edx, ebp - -#ifdef CONFIG_SMP - /* Check NPX State */ - cmp byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_LOADED - jz NpxLoaded -SetStack: -#endif - - /* Set new stack */ - mov [edi+KTHREAD_KERNEL_STACK], esp - - /* Checking NPX, disable interrupts now */ - mov eax, [esi+KTHREAD_INITIAL_STACK] - cli - - /* Get the NPX State */ - movzx ecx, byte ptr [esi+KTHREAD_NPX_STATE] - - /* Clear the other bits, merge in CR0, merge in FPU CR0 bits and compare */ - and edx, ~(CR0_MP + CR0_EM + CR0_TS) - or ecx, edx - or ecx, [eax - (NPX_FRAME_LENGTH - FN_CR0_NPX_STATE)] - cmp ebp, ecx - jnz NewCr0 - -StackOk: - /* Enable interrupts and set the current stack */ - sti - mov esp, [esi+KTHREAD_KERNEL_STACK] - - /* Check if address space switch is needed */ - mov ebp, [esi+KTHREAD_APCSTATE_PROCESS] - mov eax, [edi+KTHREAD_APCSTATE_PROCESS] - cmp ebp, eax - jz SameProcess - -#ifdef CONFIG_SMP - /* Get the active processors and XOR with the process' */ - mov ecx, [ebx+KPCR_SET_MEMBER_COPY] - lock xor [ebp+KPROCESS_ACTIVE_PROCESSORS], ecx - lock xor [eax+KPROCESS_ACTIVE_PROCESSORS], ecx - - /* Assert change went ok */ -#if DBG - test [ebp+KPROCESS_ACTIVE_PROCESSORS], ecx - jz WrongActiveCpu - test [eax+KPROCESS_ACTIVE_PROCESSORS], ecx - jnz WrongActiveCpu -#endif -#endif - - /* Check if we need an LDT */ - mov ecx, [ebp+KPROCESS_LDT_DESCRIPTOR0] - or ecx, [eax+KPROCESS_LDT_DESCRIPTOR0] - jnz LdtReload - -UpdateCr3: - /* Switch address space */ - mov eax, [ebp+KPROCESS_DIRECTORY_TABLE_BASE] - mov cr3, eax - -SameProcess: - -#ifdef CONFIG_SMP - /* Release swap lock */ - and byte ptr [edi+KTHREAD_SWAP_BUSY], 0 -#endif - - /* Clear gs */ - xor eax, eax - mov gs, ax - - /* Set the TEB */ - mov eax, [esi+KTHREAD_TEB] - mov [ebx+KPCR_TEB], eax - mov ecx, [ebx+KPCR_GDT] - mov [ecx+0x3A], ax - shr eax, 16 - mov [ecx+0x3C], al - mov [ecx+0x3F], ah - - /* Get stack pointer */ - mov eax, [esi+KTHREAD_INITIAL_STACK] - - /* Make space for the NPX Frame */ - sub eax, NPX_FRAME_LENGTH - - /* Check if this isn't V86 Mode, so we can bias the Esp0 */ - test dword ptr [eax - KTRAP_FRAME_SIZE + KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK - jnz NoAdjust - - /* Bias esp */ - sub eax, KTRAP_FRAME_V86_GS - KTRAP_FRAME_SS - -NoAdjust: - - /* Set new ESP0 */ - mov ecx, [ebx+KPCR_TSS] - mov [ecx+KTSS_ESP0], eax - - /* Set current IOPM offset in the TSS */ - mov ax, [ebp+KPROCESS_IOPM_OFFSET] - mov [ecx+KTSS_IOMAPBASE], ax - - /* Increase context switches */ - inc dword ptr [esi+KTHREAD_CONTEXT_SWITCHES] - - /* Restore exception list */ - pop [ebx+KPCR_EXCEPTION_LIST] - - /* Restore IRQL */ - pop ecx - - /* DPC shouldn't be active */ - cmp byte ptr [ebx+KPCR_PRCB_DPC_ROUTINE_ACTIVE], 0 - jnz BugCheckDpc - - /* Check if kernel APCs are pending */ - cmp byte ptr [esi+KTHREAD_PENDING_KERNEL_APC], 0 - jnz CheckApc - - /* No APCs, return */ - xor eax, eax - ret - -CheckApc: - - /* Check if they're disabled */ - cmp word ptr [esi+KTHREAD_SPECIAL_APC_DISABLE], 0 - jnz ApcReturn - test cl, cl - jz ApcReturn - - /* Request APC Delivery */ - mov cl, APC_LEVEL - call @HalRequestSoftwareInterrupt@4 - or eax, esp - -ApcReturn: - - /* Return with APC pending */ - setz al - ret - -LdtReload: - /* Check if it's empty */ - mov eax, [ebp+KPROCESS_LDT_DESCRIPTOR0] - test eax, eax - jz LoadLdt - - /* Write the LDT Selector */ - mov ecx, [ebx+KPCR_GDT] - mov [ecx+KGDT_LDT], eax - mov eax, [ebp+KPROCESS_LDT_DESCRIPTOR1] - mov [ecx+KGDT_LDT+4], eax - - /* Write the INT21 handler */ - mov ecx, [ebx+KPCR_IDT] - mov eax, [ebp+KPROCESS_INT21_DESCRIPTOR0] - mov [ecx+0x108], eax - mov eax, [ebp+KPROCESS_INT21_DESCRIPTOR1] - mov [ecx+0x10C], eax - - /* Save LDT Selector */ - mov eax, KGDT_LDT - -LoadLdt: - lldt ax - jmp UpdateCr3 - -NewCr0: - -#if DBG - /* Assert NPX State */ - test byte ptr [esi+KTHREAD_NPX_STATE], ~(NPX_STATE_NOT_LOADED) - jnz InvalidNpx - test dword ptr [eax - (NPX_FRAME_LENGTH - FN_CR0_NPX_STATE)], ~(CR0_PE + CR0_MP + CR0_EM + CR0_TS) - jnz InvalidNpx -#endif - - /* Update CR0 */ - mov cr0, ecx - jmp StackOk - -#ifdef CONFIG_SMP -NpxLoaded: - - /* Mask out FPU flags */ - and edx, ~(CR0_MP + CR0_EM + CR0_TS) - - /* Get the NPX Frame */ - mov ecx, [edi+KTHREAD_INITIAL_STACK] - sub ecx, NPX_FRAME_LENGTH - - /* Check if we have a new CR0 */ - cmp ebp, edx - jz Cr0Equal - - /* We do, update it */ - mov cr0, edx - mov ebp, edx - -Cr0Equal: - - /* Save the NPX State */ - fxsave [ecx] - mov byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_NOT_LOADED - - /* Clear the NPX Thread */ - mov dword ptr [ebx+KPCR_NPX_THREAD], 0 - - /* Jump back */ - jmp SetStack -#endif - -WmiTrace: - - /* No WMI support yet */ - int 3 - - /* Jump back */ - jmp AfterTrace - -BugCheckDpc: - - /* Bugcheck the machine, printing out the threads being switched */ - mov eax, [edi+KTHREAD_INITIAL_STACK] - push 0 - push eax - push esi - push edi - push ATTEMPTED_SWITCH_FROM_DPC - call _KeBugCheckEx@20 - -#if DBG -InvalidNpx: - int 3 -WrongActiveCpu: - int 3 -WrongCpu: - int 3 -#endif + /* Build switch frame */ + sub esp, 2 * 4 + mov ecx, esp + call @KiSwapContextEntry@8 + mov ecx, 0xB00BFACA + jmp $ .endfunc /*++ @@ -511,6 +243,20 @@ _Ki386SetupAndExitToV86Mode@4: jmp $ .endfunc +.globl @KiSwitchThreads@8 +.func @KiSwitchThreads@8, @KiSwitchThreads@8 +@KiSwitchThreads@8: + + /* Load the new kernel stack and switch OS to new thread */ + mov esp, [edx+KTHREAD_KERNEL_STACK] + mov edx, esp + call @KiSwapContextExit@8 + + /* Now we're on the new thread. Return to the caller to restore registers */ + add esp, 2 * 4 + ret +.endfunc + .globl @Ki386BiosCallReturnAddress@4 @Ki386BiosCallReturnAddress@4: diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index b2a40258936..538d543248b 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -42,6 +42,13 @@ typedef struct _KKINIT_FRAME FX_SAVE_AREA FxSaveArea; } KKINIT_FRAME, *PKKINIT_FRAME; +VOID +FASTCALL +KiSwitchThreads( + IN PKTHREAD OldThread, + IN PKTHREAD NewThread +); + /* FUNCTIONS *****************************************************************/ VOID @@ -311,4 +318,133 @@ KiIdleLoop(VOID) } } +BOOLEAN +FASTCALL +KiSwapContextExit(IN PKTHREAD OldThread, + IN PKSWITCHFRAME SwitchFrame) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPROCESS OldProcess, NewProcess; + PKGDTENTRY GdtEntry; + PKTHREAD NewThread; + PKUINIT_FRAME InitFrame; + + /* We are on the new thread stack now */ + NewThread = Pcr->PrcbData.CurrentThread; + + /* Now we are the new thread. Check if it's in a new process */ + OldProcess = OldThread->ApcState.Process; + NewProcess = NewThread->ApcState.Process; + if (OldProcess != NewProcess) + { + /* Check if there is a different LDT */ + if (*(PULONGLONG)&OldProcess->LdtDescriptor != *(PULONGLONG)&NewProcess->LdtDescriptor) + { + DPRINT1("LDT switch not implemented\n"); + ASSERT(FALSE); + } + + /* Switch address space and flush TLB */ + __writecr3(NewProcess->DirectoryTableBase[0]); + } + + /* Clear GS */ + Ke386SetGs(0); + + /* Set the TEB */ + Pcr->NtTib.Self = (PVOID)NewThread->Teb; + GdtEntry = &Pcr->GDT[KGDT_R3_TEB / sizeof(KGDTENTRY)]; + GdtEntry->BaseLow = (USHORT)((ULONG_PTR)NewThread->Teb & 0xFFFF); + GdtEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)NewThread->Teb >> 16); + GdtEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)NewThread->Teb >> 24); + + /* Set new TSS fields */ + InitFrame = (PKUINIT_FRAME)NewThread->InitialStack - 1; + Pcr->TSS->Esp0 = (ULONG_PTR)&InitFrame->TrapFrame; + if (!(InitFrame->TrapFrame.EFlags & EFLAGS_V86_MASK)) + { + Pcr->TSS->Esp0 -= (FIELD_OFFSET(KTRAP_FRAME, V86Gs) - FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs)); + } + Pcr->TSS->IoMapBase = NewProcess->IopmOffset; + + /* Increase thread context switches */ + NewThread->ContextSwitches++; + + /* Load data from switch frame */ + Pcr->NtTib.ExceptionList = SwitchFrame->ExceptionList; + + /* DPCs shouldn't be active */ + if (Pcr->PrcbData.DpcRoutineActive) + { + /* Crash the machine */ + KeBugCheckEx(ATTEMPTED_SWITCH_FROM_DPC, + (ULONG_PTR)OldThread, + (ULONG_PTR)NewThread, + (ULONG_PTR)OldThread->InitialStack, + 0); + } + + /* Kernel APCs may be pending */ + if (NewThread->ApcState.KernelApcPending) + { + /* Are APCs enabled? */ + if (!NewThread->SpecialApcDisable) + { + /* Request APC delivery */ + if (!SwitchFrame->ApcBypassDisable) HalRequestSoftwareInterrupt(APC_LEVEL); + return TRUE; + } + } + + /* Return */ + return FALSE; +} + +VOID +FASTCALL +KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, + IN ULONG_PTR OldThreadAndApcFlag) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKTHREAD OldThread, NewThread; + ULONG Cr0, NewCr0; + + /* Switch threads, check for APC disable */ + ASSERT(OldThreadAndApcFlag &~ 1); + + /* Save APC bypass disable */ + SwitchFrame->ApcBypassDisable = OldThreadAndApcFlag & 3; + SwitchFrame->ExceptionList = Pcr->NtTib.ExceptionList; + + /* Increase context switch count and check if tracing is enabled */ + Pcr->ContextSwitches++; + if (Pcr->PerfGlobalGroupMask) + { + /* We don't support this yet on x86 either */ + DPRINT1("WMI Tracing not supported\n"); + ASSERT(FALSE); + } + + /* Get thread pointers */ + OldThread = (PKTHREAD)(OldThreadAndApcFlag & ~3); + NewThread = Pcr->PrcbData.CurrentThread; + + /* Get the old thread and set its kernel stack */ + OldThread->KernelStack = SwitchFrame; + + /* ISRs can change FPU state, so disable interrupts while checking */ + _disable(); + + /* Get current and new CR0 and check if they've changed */ + Cr0 = __readcr0(); + NewCr0 = NewThread->NpxState | + (Cr0 & ~(CR0_MP | CR0_EM | CR0_TS)) | + ((PKUINIT_FRAME)NewThread->InitialStack - 1)->FxSaveArea.Cr0NpxState; + if (Cr0 != NewCr0) __writecr0(NewCr0); + + /* Now enable interrupts and do the switch */ + _enable(); + KiSwitchThreads(OldThread, NewThread); +} + /* EOF */ From b4593924da2f340e4f9b875d8f4ece8c0141abb1 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Mon, 8 Nov 2010 02:37:17 +0000 Subject: [PATCH 007/132] [NTOS]: KiDispatchInterrupt (the DPC handler) in C, instead of ASM. svn path=/trunk/; revision=49521 --- reactos/ntoskrnl/ke/i386/ctxswitch.S | 119 ++------------------------- reactos/ntoskrnl/ke/i386/thrdini.c | 68 +++++++++++++++ 2 files changed, 76 insertions(+), 111 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/ctxswitch.S b/reactos/ntoskrnl/ke/i386/ctxswitch.S index 53a7e036dd5..1ae3aaf18bc 100644 --- a/reactos/ntoskrnl/ke/i386/ctxswitch.S +++ b/reactos/ntoskrnl/ke/i386/ctxswitch.S @@ -112,121 +112,18 @@ ret .endfunc -/* DPC INTERRUPT HANDLER ******************************************************/ +.globl @KiRetireDpcListInDpcStack@8 +.func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8 +@KiRetireDpcListInDpcStack@8: -.globl _KiDispatchInterrupt@0 -.func KiDispatchInterrupt@0 -_KiDispatchInterrupt@0: - - /* Preserve EBX */ - push ebx - - /* Get the PCR and disable interrupts */ - mov ebx, PCR[KPCR_SELF] - cli - - /* Check if we have to deliver DPCs, timers, or deferred threads */ - mov eax, [ebx+KPCR_PRCB_DPC_QUEUE_DEPTH] - or eax, [ebx+KPCR_PRCB_TIMER_REQUEST] - or eax, [ebx+KPCR_PRCB_DEFERRED_READY_LIST_HEAD] - jz CheckQuantum - - /* Save stack pointer and exception list, then clear it */ - push ebp - push dword ptr [ebx+KPCR_EXCEPTION_LIST] - mov dword ptr [ebx+KPCR_EXCEPTION_LIST], -1 - - /* Save the stack and switch to the DPC Stack */ - mov edx, esp - mov esp, [ebx+KPCR_PRCB_DPC_STACK] - push edx - - /* Deliver DPCs */ - mov ecx, [ebx+KPCR_PRCB] + /* Switch stacks and retire DPCs */ + mov eax, esp + mov esp, edx + push eax call @KiRetireDpcList@4 - /* Restore stack and exception list */ + /* Return on original stack */ pop esp - pop dword ptr [ebx+KPCR_EXCEPTION_LIST] - pop ebp - -CheckQuantum: - - /* Re-enable interrupts */ - sti - - /* Check if we have quantum end */ - cmp byte ptr [ebx+KPCR_PRCB_QUANTUM_END], 0 - jnz QuantumEnd - - /* Check if we have a thread to swap to */ - cmp byte ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0 - je Return - - /* Make space on the stack to save registers */ - sub esp, 3 * 4 - mov [esp+8], esi - mov [esp+4], edi - mov [esp+0], ebp - - /* Get the current thread */ - mov edi, [ebx+KPCR_CURRENT_THREAD] - -#ifdef CONFIG_SMP - /* Raise to synch level */ - call _KeRaiseIrqlToSynchLevel@0 - - /* Set context swap busy */ - mov byte ptr [edi+KTHREAD_SWAP_BUSY], 1 - - /* Acquire the PRCB Lock */ - lock bts dword ptr [ebx+KPCR_PRCB_PRCB_LOCK], 0 - jnb GetNext - lea ecx, [ebx+KPCR_PRCB_PRCB_LOCK] - call @KefAcquireSpinLockAtDpcLevel@4 -#endif - -GetNext: - /* Get the next thread and clear it */ - mov esi, [ebx+KPCR_PRCB_NEXT_THREAD] - and dword ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0 - - /* Set us as the current running thread */ - mov [ebx+KPCR_CURRENT_THREAD], esi - mov byte ptr [esi+KTHREAD_STATE_], Running - mov byte ptr [edi+KTHREAD_WAIT_REASON], WrDispatchInt - - /* Put thread in ECX and get the PRCB in EDX */ - mov ecx, edi - lea edx, [ebx+KPCR_PRCB_DATA] - call @KiQueueReadyThread@8 - - /* Set APC_LEVEL and do the swap */ - mov cl, APC_LEVEL - call @KiSwapContextInternal@0 - -#ifdef CONFIG_SMP - /* Lower IRQL back to dispatch */ - mov cl, DISPATCH_LEVEL - call @KfLowerIrql@4 -#endif - - /* Restore registers */ - mov ebp, [esp+0] - mov edi, [esp+4] - mov esi, [esp+8] - add esp, 3*4 - -Return: - /* All done */ - pop ebx - ret - -QuantumEnd: - /* Disable quantum end and process it */ - mov byte ptr [ebx+KPCR_PRCB_QUANTUM_END], 0 - call _KiQuantumEnd@0 - pop ebx ret .endfunc diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index 538d543248b..338a10cb293 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -49,6 +49,13 @@ KiSwitchThreads( IN PKTHREAD NewThread ); +VOID +FASTCALL +KiRetireDpcListInDpcStack( + IN PKPRCB Prcb, + IN PVOID DpcStack +); + /* FUNCTIONS *****************************************************************/ VOID @@ -447,4 +454,65 @@ KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, KiSwitchThreads(OldThread, NewThread); } +VOID +NTAPI +KiDispatchInterrupt(VOID) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPRCB Prcb = &Pcr->PrcbData; + PVOID OldHandler; + PKTHREAD NewThread, OldThread; + + /* Disable interrupts */ + _disable(); + + /* Check for pending timers, pending DPCs, or pending ready threads */ + if ((Prcb->DpcData[0].DpcQueueDepth) || + (Prcb->TimerRequest) || + (Prcb->DeferredReadyListHead.Next)) + { + /* Switch to safe execution context */ + OldHandler = Pcr->NtTib.ExceptionList; + Pcr->NtTib.ExceptionList = EXCEPTION_CHAIN_END; + + /* Retire DPCs while under the DPC stack */ + KiRetireDpcListInDpcStack(Prcb, Prcb->DpcStack); + + /* Restore context */ + Pcr->NtTib.ExceptionList = OldHandler; + } + + /* Re-enable interrupts */ + _enable(); + + /* Check for quantum end */ + if (Prcb->QuantumEnd) + { + /* Handle quantum end */ + Prcb->QuantumEnd = FALSE; + KiQuantumEnd(); + } + else if (Prcb->NextThread) + { + /* Capture current thread data */ + OldThread = Prcb->CurrentThread; + NewThread = Prcb->NextThread; + + /* Set new thread data */ + Prcb->NextThread = NULL; + Prcb->CurrentThread = NewThread; + + /* The thread is now running */ + NewThread->State = Running; + OldThread->WaitReason = WrDispatchInt; + + /* Make the old thread ready */ + KxQueueReadyThread(OldThread, Prcb); + + /* Swap to the new thread. FIXME: APC Bypass */ + KiSwapContext(OldThread, NewThread); + } +} + + /* EOF */ From 44eef5b073855697f1eca1e0841787dd5b600a41 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 8 Nov 2010 10:04:43 +0000 Subject: [PATCH 008/132] [SHLWAPI] Explicitly add msvcrt before ntdll to use it's *sprintf functions. Fixes bug 5557 svn path=/trunk/; revision=49522 --- reactos/dll/win32/shlwapi/shlwapi.rbuild | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/dll/win32/shlwapi/shlwapi.rbuild b/reactos/dll/win32/shlwapi/shlwapi.rbuild index 37fb2e8427f..24d2e5c0502 100644 --- a/reactos/dll/win32/shlwapi/shlwapi.rbuild +++ b/reactos/dll/win32/shlwapi/shlwapi.rbuild @@ -37,6 +37,7 @@ shell32 winmm version + msvcrt ntdll From e8c269c0c481f97e306226a9ac3ee0dbb44726f0 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Mon, 8 Nov 2010 11:56:22 +0000 Subject: [PATCH 009/132] [NTOS]: Optimize new context switching code to avoid wasted cycles. svn path=/trunk/; revision=49523 --- reactos/ntoskrnl/include/internal/ke.h | 4 +- reactos/ntoskrnl/ke/dpc.c | 2 +- reactos/ntoskrnl/ke/i386/ctxswitch.S | 90 ++++---------------------- reactos/ntoskrnl/ke/i386/thrdini.c | 11 ++-- reactos/ntoskrnl/ke/thrdschd.c | 4 +- reactos/ntoskrnl/ke/wait.c | 2 +- 6 files changed, 24 insertions(+), 89 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 45d47d1612a..56f3ee013c2 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -298,8 +298,8 @@ KeReadStateThread(IN PKTHREAD Thread); BOOLEAN FASTCALL KiSwapContext( - IN PKTHREAD CurrentThread, - IN PKTHREAD NewThread + IN KIRQL WaitIrql, + IN PKTHREAD CurrentThread ); VOID diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index 7b4446a543b..9895cae3f27 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -534,7 +534,7 @@ KiQuantumEnd(VOID) Thread->WaitIrql = APC_LEVEL; /* Swap threads */ - KiSwapContext(Thread, NextThread); + KiSwapContext(APC_LEVEL, Thread); /* Lower IRQL back to DISPATCH_LEVEL */ KeLowerIrql(DISPATCH_LEVEL); diff --git a/reactos/ntoskrnl/ke/i386/ctxswitch.S b/reactos/ntoskrnl/ke/i386/ctxswitch.S index 1ae3aaf18bc..9a9c95f4db1 100644 --- a/reactos/ntoskrnl/ke/i386/ctxswitch.S +++ b/reactos/ntoskrnl/ke/i386/ctxswitch.S @@ -13,70 +13,20 @@ #include .intel_syntax noprefix -#define Ready 1 -#define Running 2 -#define WrDispatchInt 0x1F - /* FUNCTIONS ****************************************************************/ -/*++ - * KiSwapContextInternal - * - * The KiSwapContextInternal routine switches context to another thread. - * - * Params: - * ESI - Pointer to the KTHREAD to which the caller wishes to - * switch to. - * EDI - Pointer to the KTHREAD to which the caller wishes to - * switch from. - * - * Returns: - * None. - * - * Remarks: - * Absolutely all registers except ESP can be trampled here for maximum code flexibility. - * - *--*/ .globl @KiSwapContextInternal@0 .func @KiSwapContextInternal@0, @KiSwapContextInternal@0 @KiSwapContextInternal@0: - /* Set APC Bypass Disable and old thread pointer */ - mov edx, edi - or dl, cl - /* Build switch frame */ sub esp, 2 * 4 mov ecx, esp - call @KiSwapContextEntry@8 - mov ecx, 0xB00BFACA - jmp $ + jmp @KiSwapContextEntry@8 .endfunc -/*++ - * KiSwapContext - * - * The KiSwapContext routine switches context to another thread. - * - * Params: - * TargetThread - Pointer to the KTHREAD to which the caller wishes to - * switch to. - * - * Returns: - * The WaitStatus of the Target Thread. - * - * Remarks: - * This is a wrapper around KiSwapContextInternal which will save all the - * non-volatile registers so that the Internal function can use all of - * them. It will also save the old current thread and set the new one. - * - * The calling thread does not return after KiSwapContextInternal until - * another thread switches to IT. - * - *--*/ .globl @KiSwapContext@8 .func @KiSwapContext@8, @KiSwapContext@8 @KiSwapContext@8: - /* Save 4 registers */ sub esp, 4 * 4 @@ -86,17 +36,8 @@ mov [esp+4], edi mov [esp+0], ebp - /* Get the current KPCR */ - mov ebx, fs:[KPCR_SELF] - - /* Get the Current Thread */ - mov edi, ecx - - /* Get the New Thread */ - mov esi, edx - /* Get the wait IRQL */ - movzx ecx, byte ptr [edi+KTHREAD_WAIT_IRQL] + or dl, cl /* Do the swap with the registers correctly setup */ call @KiSwapContextInternal@0 @@ -112,10 +53,21 @@ ret .endfunc +.globl @KiSwitchThreads@8 +.func @KiSwitchThreads@8, @KiSwitchThreads@8 +@KiSwitchThreads@8: + /* Load the new kernel stack and switch OS to new thread */ + mov esp, edx + call @KiSwapContextExit@8 + + /* Now we're on the new thread. Return to the caller to restore registers */ + add esp, 2 * 4 + ret +.endfunc + .globl @KiRetireDpcListInDpcStack@8 .func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8 @KiRetireDpcListInDpcStack@8: - /* Switch stacks and retire DPCs */ mov eax, esp mov esp, edx @@ -140,20 +92,6 @@ _Ki386SetupAndExitToV86Mode@4: jmp $ .endfunc -.globl @KiSwitchThreads@8 -.func @KiSwitchThreads@8, @KiSwitchThreads@8 -@KiSwitchThreads@8: - - /* Load the new kernel stack and switch OS to new thread */ - mov esp, [edx+KTHREAD_KERNEL_STACK] - mov edx, esp - call @KiSwapContextExit@8 - - /* Now we're on the new thread. Return to the caller to restore registers */ - add esp, 2 * 4 - ret -.endfunc - .globl @Ki386BiosCallReturnAddress@4 @Ki386BiosCallReturnAddress@4: diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index 338a10cb293..b90ae664d96 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -309,7 +309,7 @@ KiIdleLoop(VOID) NewThread->State = Running; /* Switch away from the idle thread */ - KiSwapContext(OldThread, NewThread); + KiSwapContext(APC_LEVEL, OldThread); /* We are back in the idle thread -- disable interrupts again */ _enable(); @@ -416,9 +416,6 @@ KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, PKTHREAD OldThread, NewThread; ULONG Cr0, NewCr0; - /* Switch threads, check for APC disable */ - ASSERT(OldThreadAndApcFlag &~ 1); - /* Save APC bypass disable */ SwitchFrame->ApcBypassDisable = OldThreadAndApcFlag & 3; SwitchFrame->ExceptionList = Pcr->NtTib.ExceptionList; @@ -451,7 +448,7 @@ KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, /* Now enable interrupts and do the switch */ _enable(); - KiSwitchThreads(OldThread, NewThread); + KiSwitchThreads(OldThread, NewThread->KernelStack); } VOID @@ -509,8 +506,8 @@ KiDispatchInterrupt(VOID) /* Make the old thread ready */ KxQueueReadyThread(OldThread, Prcb); - /* Swap to the new thread. FIXME: APC Bypass */ - KiSwapContext(OldThread, NewThread); + /* Swap to the new thread */ + KiSwapContext(APC_LEVEL, OldThread); } } diff --git a/reactos/ntoskrnl/ke/thrdschd.c b/reactos/ntoskrnl/ke/thrdschd.c index 040073cdb09..d100c3b8900 100644 --- a/reactos/ntoskrnl/ke/thrdschd.c +++ b/reactos/ntoskrnl/ke/thrdschd.c @@ -387,7 +387,7 @@ KiSwapThread(IN PKTHREAD CurrentThread, WaitIrql = CurrentThread->WaitIrql; /* Swap contexts */ - ApcState = KiSwapContext(CurrentThread, NextThread); + ApcState = KiSwapContext(WaitIrql, CurrentThread); /* Get the wait status */ WaitStatus = CurrentThread->WaitStatus; @@ -754,7 +754,7 @@ NtYieldExecution(VOID) ASSERT(OldIrql <= DISPATCH_LEVEL); /* Swap to new thread */ - KiSwapContext(Thread, NextThread); + KiSwapContext(APC_LEVEL, Thread); Status = STATUS_SUCCESS; } else diff --git a/reactos/ntoskrnl/ke/wait.c b/reactos/ntoskrnl/ke/wait.c index a4737b0b7fa..3fc51062ba4 100644 --- a/reactos/ntoskrnl/ke/wait.c +++ b/reactos/ntoskrnl/ke/wait.c @@ -249,7 +249,7 @@ KiExitDispatcher(IN KIRQL OldIrql) Thread->WaitIrql = OldIrql; /* Swap threads and check if APCs were pending */ - PendingApc = KiSwapContext(Thread, NextThread); + PendingApc = KiSwapContext(OldIrql, Thread); if (PendingApc) { /* Lower only to APC */ From f205f243bb7572f13caf9ed343bf33825a2ace18 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Mon, 8 Nov 2010 12:35:50 +0000 Subject: [PATCH 010/132] [NTOS]: Assign a working set to the system process and correctly initialize its address space. [NTOS]: Assign the working set list address, system-wide, but per-process (in hyperspace). [NTOS]: Give every process its working set page, and store it. Build a bogus working set list (MMWSL). [NTOS]: Use the process working set list (MMWSL) to track page table references during faults, just as Windows does. [NTOS]: Correctly initialize the colored page list heads and assert their validity. svn path=/trunk/; revision=49525 --- reactos/ntoskrnl/include/internal/i386/mm.h | 6 +- reactos/ntoskrnl/mm/ARM3/i386/init.c | 66 +++++++++++++- reactos/ntoskrnl/mm/ARM3/miarm.h | 1 + reactos/ntoskrnl/mm/ARM3/pagfault.c | 8 ++ reactos/ntoskrnl/mm/ARM3/procsup.c | 95 ++++++++++++++++++++- 5 files changed, 172 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/i386/mm.h b/reactos/ntoskrnl/include/internal/i386/mm.h index 1014884b099..f02cc787a71 100644 --- a/reactos/ntoskrnl/include/internal/i386/mm.h +++ b/reactos/ntoskrnl/include/internal/i386/mm.h @@ -84,7 +84,11 @@ PULONG MmGetPageDirectory(VOID); #define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE #define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \ MI_HYPERSPACE_PTES * PAGE_SIZE) -#define MI_ZERO_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ +#define MI_DUMMY_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ + PAGE_SIZE) +#define MI_VAD_BITMAP (PMMPTE)(MI_DUMMY_PTE + \ + PAGE_SIZE) +#define MI_WORKING_SET_LIST (PMMPTE)(MI_VAD_BITMAP + \ PAGE_SIZE) /* On x86, these two are the same */ diff --git a/reactos/ntoskrnl/mm/ARM3/i386/init.c b/reactos/ntoskrnl/mm/ARM3/i386/init.c index 5ac50e77a6e..70707a6e98a 100644 --- a/reactos/ntoskrnl/mm/ARM3/i386/init.c +++ b/reactos/ntoskrnl/mm/ARM3/i386/init.c @@ -160,7 +160,9 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) MMPTE TempPde, TempPte; PVOID NonPagedPoolExpansionVa; KIRQL OldIrql; - + PMMPFN Pfn1; + ULONG Flags; + /* Check for kernel stack size that's too big */ if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB)) { @@ -558,6 +560,9 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) MmFirstReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_START); MmLastReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_END); MmFirstReservedMappingPte->u.Hard.PageFrameNumber = MI_HYPERSPACE_PTES; + + /* Set the working set address */ + MmWorkingSetList = (PVOID)MI_WORKING_SET_LIST; // // Reserve system PTEs for zeroing PTEs and clear them @@ -571,6 +576,28 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) // MiFirstReservedZeroingPte->u.Hard.PageFrameNumber = MI_ZERO_PTES - 1; + /* Lock PFN database */ + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + + /* Reset the ref/share count so that MmInitializeProcessAddressSpace works */ + Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(MiAddressToPde(PDE_BASE))); + Pfn1->u2.ShareCount = 0; + Pfn1->u3.e2.ReferenceCount = 0; + + /* Get a page for the working set list */ + MI_SET_USAGE(MI_USAGE_PAGE_TABLE); + MI_SET_PROCESS2("Kernel WS List"); + PageFrameIndex = MiRemoveAnyPage(0); + TempPte.u.Hard.PageFrameNumber = PageFrameIndex; + + /* Map the working set list */ + PointerPte = MiAddressToPte(MmWorkingSetList); + MI_WRITE_VALID_PTE(PointerPte, TempPte); + + /* Zero it out, and save the frame index */ + RtlZeroMemory(MiPteToAddress(PointerPte), PAGE_SIZE); + PsGetCurrentProcess()->WorkingSetPage = PageFrameIndex; + /* Check for Pentium LOCK errata */ if (KiI386PentiumLockErrataPresent) { @@ -581,6 +608,43 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) PointerPte->u.Hard.WriteThrough = 1; } + /* Release the lock */ + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + + /* Initialize the bogus address space */ + Flags = 0; + MmInitializeProcessAddressSpace(PsGetCurrentProcess(), NULL, NULL, &Flags, NULL); + + /* Make sure the color lists are valid */ + ASSERT(MmFreePagesByColor[0] < (PMMCOLOR_TABLES)PTE_BASE); + StartPde = MiAddressToPde(MmFreePagesByColor[0]); + ASSERT(StartPde->u.Hard.Valid == 1); + PointerPte = MiAddressToPte(MmFreePagesByColor[0]); + ASSERT(PointerPte->u.Hard.Valid == 1); + LastPte = MiAddressToPte((ULONG_PTR)&MmFreePagesByColor[1][MmSecondaryColors] - 1); + ASSERT(LastPte->u.Hard.Valid == 1); + + /* Loop the color list PTEs */ + while (PointerPte <= LastPte) + { + /* Get the PFN entry */ + Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(PointerPte)); + if (!Pfn1->u3.e2.ReferenceCount) + { + /* Fill it out */ + Pfn1->u4.PteFrame = PFN_FROM_PTE(StartPde); + Pfn1->PteAddress = PointerPte; + Pfn1->u2.ShareCount++; + Pfn1->u3.e2.ReferenceCount = 1; + Pfn1->u3.e1.PageLocation = ActiveAndValid; + Pfn1->u3.e1.CacheAttribute = MiCached; + } + + /* Keep going */ + PointerPte++; + } + + /* All done */ return STATUS_SUCCESS; } diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index 8e835503dac..22239ce40d8 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -513,6 +513,7 @@ extern BOOLEAN MmZeroingPageThreadActive; extern KEVENT MmZeroingPageEvent; extern ULONG MmSystemPageColor; extern ULONG MmProcessColorSeed; +extern PMMWSL MmWorkingSetList; // // Figures out the hardware bits for a PTE diff --git a/reactos/ntoskrnl/mm/ARM3/pagfault.c b/reactos/ntoskrnl/mm/ARM3/pagfault.c index 5cffe94cbd3..41cce6dcfc7 100644 --- a/reactos/ntoskrnl/mm/ARM3/pagfault.c +++ b/reactos/ntoskrnl/mm/ARM3/pagfault.c @@ -991,6 +991,14 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction, MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread); return Status; } + + /* Is this a user address? */ + if (Address <= MM_HIGHEST_USER_ADDRESS) + { + /* Add an additional page table reference */ + MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; + ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + } /* Did we get a prototype PTE back? */ if (!ProtoPte) diff --git a/reactos/ntoskrnl/mm/ARM3/procsup.c b/reactos/ntoskrnl/mm/ARM3/procsup.c index fca03ee02e7..aec5af6e413 100644 --- a/reactos/ntoskrnl/mm/ARM3/procsup.c +++ b/reactos/ntoskrnl/mm/ARM3/procsup.c @@ -19,6 +19,7 @@ /* GLOBALS ********************************************************************/ ULONG MmProcessColorSeed = 0x12345678; +PMMWSL MmWorkingSetList; /* PRIVATE FUNCTIONS **********************************************************/ @@ -892,6 +893,32 @@ MmCreateTeb(IN PEPROCESS Process, return Status; } +VOID +NTAPI +MiInitializeWorkingSetList(IN PEPROCESS CurrentProcess) +{ + PMMPFN Pfn1; + + /* Setup some bogus list data */ + MmWorkingSetList->LastEntry = CurrentProcess->Vm.MinimumWorkingSetSize; + MmWorkingSetList->HashTable = NULL; + MmWorkingSetList->HashTableSize = 0; + MmWorkingSetList->NumberOfImageWaiters = 0; + MmWorkingSetList->Wsle = (PVOID)0xDEADBABE; + MmWorkingSetList->VadBitMapHint = 1; + MmWorkingSetList->HashTableStart = (PVOID)0xBADAB00B; + MmWorkingSetList->HighestPermittedHashAddress = (PVOID)0xCAFEBABE; + MmWorkingSetList->FirstFree = 1; + MmWorkingSetList->FirstDynamic = 2; + MmWorkingSetList->NextSlot = 3; + MmWorkingSetList->LastInitializedWsle = 4; + + /* The rule is that the owner process is always in the FLINK of the PDE's PFN entry */ + Pfn1 = MiGetPfnEntry(MiAddressToPte(PDE_BASE)->u.Hard.PageFrameNumber); + ASSERT(Pfn1->u4.PteFrame == MiGetPfnEntryIndex(Pfn1)); + Pfn1->u1.Event = (PKEVENT)CurrentProcess; +} + NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, @@ -912,6 +939,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process, PWCHAR Source; PCHAR Destination; USHORT Length = 0; + MMPTE TempPte; /* We should have a PDE */ ASSERT(Process->Pcb.DirectoryTableBase[0] != 0); @@ -944,6 +972,22 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process, PointerPde = MiAddressToPde(HYPER_SPACE); PageFrameNumber = PFN_FROM_PTE(PointerPde); MiInitializePfn(PageFrameNumber, PointerPde, TRUE); + + /* Setup the PFN for the PTE for the working set */ + PointerPte = MiAddressToPte(MI_WORKING_SET_LIST); + MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, MM_READWRITE, 0); + ASSERT(PointerPte->u.Long != 0); + PageFrameNumber = PFN_FROM_PTE(PointerPte); + MI_WRITE_INVALID_PTE(PointerPte, DemandZeroPte); + MiInitializePfn(PageFrameNumber, PointerPte, TRUE); + TempPte.u.Hard.PageFrameNumber = PageFrameNumber; + MI_WRITE_VALID_PTE(PointerPte, TempPte); + + /* Now initialize the working set list */ + MiInitializeWorkingSetList(Process); + + /* Sanity check */ + ASSERT(Process->PhysicalVadRoot == NULL); /* Release PFN lock */ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); @@ -1062,12 +1106,13 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, OUT PULONG_PTR DirectoryTableBase) { KIRQL OldIrql; - PFN_NUMBER PdeIndex, HyperIndex; + PFN_NUMBER PdeIndex, HyperIndex, WsListIndex; PMMPTE PointerPte; MMPTE TempPte, PdePte; ULONG PdeOffset; - PMMPTE SystemTable; + PMMPTE SystemTable, HyperTable; ULONG Color; + PMMPFN Pfn1; /* Choose a process color */ Process->NextPageColor = RtlRandom(&MmProcessColorSeed); @@ -1105,6 +1150,21 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, /* Zero it outside the PFN lock */ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); MiZeroPhysicalPage(HyperIndex); + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + } + + /* Get a zero page for the woring set list, if possible */ + MI_SET_USAGE(MI_USAGE_PAGE_TABLE); + Color = MI_GET_NEXT_PROCESS_COLOR(Process); + WsListIndex = MiRemoveZeroPageSafe(Color); + if (!WsListIndex) + { + /* No zero pages, grab a free one */ + WsListIndex = MiRemoveAnyPage(Color); + + /* Zero it outside the PFN lock */ + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + MiZeroPhysicalPage(WsListIndex); } else { @@ -1117,11 +1177,42 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, Process->AddressSpaceInitialized = 1; /* Set the base directory pointers */ + Process->WorkingSetPage = WsListIndex; DirectoryTableBase[0] = PdeIndex << PAGE_SHIFT; DirectoryTableBase[1] = HyperIndex << PAGE_SHIFT; /* Make sure we don't already have a page directory setup */ ASSERT(Process->Pcb.DirectoryTableBase[0] == 0); + + /* Get a PTE to map hyperspace */ + PointerPte = MiReserveSystemPtes(1, SystemPteSpace); + ASSERT(PointerPte != NULL); + + /* Build it */ + MI_MAKE_HARDWARE_PTE_KERNEL(&PdePte, + PointerPte, + MM_READWRITE, + HyperIndex); + + /* Set it dirty and map it */ + PdePte.u.Hard.Dirty = TRUE; + MI_WRITE_VALID_PTE(PointerPte, PdePte); + + /* Now get hyperspace's page table */ + HyperTable = MiPteToAddress(PointerPte); + + /* Now write the PTE/PDE entry for the working set list index itself */ + TempPte = ValidKernelPte; + TempPte.u.Hard.PageFrameNumber = WsListIndex; + PdeOffset = MiAddressToPteOffset(MmWorkingSetList); + HyperTable[PdeOffset] = TempPte; + + /* Let go of the system PTE */ + MiReleaseSystemPtes(PointerPte, 1, SystemPteSpace); + + /* Save the PTE address of the page directory itself */ + Pfn1 = MiGetPfnEntry(PdeIndex); + Pfn1->PteAddress = (PMMPTE)PDE_BASE; /* Insert us into the Mm process list */ InsertTailList(&MmProcessList, &Process->MmProcessLinks); From 64e92d2d8e99ae48b757f7626b27c6fce24509e9 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Tue, 9 Nov 2010 13:26:26 +0000 Subject: [PATCH 011/132] [NTOS]: Fix bugs in MiAllocateContiguousPages. Fixes an ASSERT Caemyr was seeting a lot (the cont-able ASSERT). svn path=/trunk/; revision=49541 --- reactos/ntoskrnl/mm/ARM3/contmem.c | 24 ++++++++++++++++++------ reactos/ntoskrnl/mm/ARM3/miarm.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/contmem.c b/reactos/ntoskrnl/mm/ARM3/contmem.c index 9a9ad53338f..744d8127aff 100644 --- a/reactos/ntoskrnl/mm/ARM3/contmem.c +++ b/reactos/ntoskrnl/mm/ARM3/contmem.c @@ -30,13 +30,16 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, ULONG i = 0; PMMPFN Pfn1, EndPfn; KIRQL OldIrql; - PAGED_CODE (); + PAGED_CODE(); ASSERT(SizeInPages != 0); // // Convert the boundary PFN into an alignment mask // BoundaryMask = ~(BoundaryPfn - 1); + + /* Disable APCs */ + KeEnterGuardedRegion(); // // Loop all the physical memory blocks @@ -69,12 +72,17 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // Now scan all the relevant PFNs in this run // Length = 0; - for (Pfn1 = MiGetPfnEntry(Page); Page < LastPage; Page++, Pfn1++) + for (Pfn1 = MI_PFN_ELEMENT(Page); Page < LastPage; Page++, Pfn1++) { // // If this PFN is in use, ignore it // - if (MiIsPfnInUse(Pfn1)) continue; + if (MiIsPfnInUse(Pfn1)) + { + //DPRINT1("In use: reset\n"); + Length = 0; + continue; + } // // If we haven't chosen a start PFN yet and the caller specified an @@ -86,6 +94,7 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // // It does not, so bail out // + //DPRINT1("Doesn't match restrictions: reset\n"); continue; } @@ -164,14 +173,17 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // Quick sanity check that the last PFN is consistent // EndPfn = Pfn1 + SizeInPages; - ASSERT(EndPfn == MiGetPfnEntry(Page + 1)); + ASSERT(EndPfn == MI_PFN_ELEMENT(Page + 1)); // // Compute the first page, and make sure it's consistent // - Page -= SizeInPages - 1; - ASSERT(Pfn1 == MiGetPfnEntry(Page)); + Page = Page - SizeInPages + 1; + ASSERT(Pfn1 == MI_PFN_ELEMENT(Page)); ASSERT(Page != 0); + + /* Enable APCs and return the page */ + KeLeaveGuardedRegion(); return Page; } diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index 22239ce40d8..119ae547475 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -851,6 +851,18 @@ MI_GET_PROTOTYPE_PTE_FOR_VPN(IN PMMVAD Vad, return ProtoPte; } +// +// Returns the PFN Database entry for the given page number +// Warning: This is not necessarily a valid PFN database entry! +// +FORCEINLINE +PMMPFN +MI_PFN_ELEMENT(IN PFN_NUMBER Pfn) +{ + /* Get the entry */ + return &MmPfnDatabase[Pfn]; +}; + BOOLEAN NTAPI MmArmInitSystem( From 0cb645cb12a6bbd1c7f25cc649f7fe19245fa259 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Thu, 11 Nov 2010 08:15:50 +0000 Subject: [PATCH 012/132] Part 1 of fixes: For some reason beyond me, I had abbreviated MiCowSectionPage to always assume CoW rather than always not CoW for cache sections. Make sure we're looking for cache type sections rather than (as we were in the branch) data file sections. More needed. svn path=/trunk/; revision=49555 --- reactos/ntoskrnl/cache/section/data.c | 9 ++++-- reactos/ntoskrnl/cache/section/fault.c | 40 +++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/cache/section/data.c b/reactos/ntoskrnl/cache/section/data.c index 89cdf74c5de..4e2d81bcc32 100644 --- a/reactos/ntoskrnl/cache/section/data.c +++ b/reactos/ntoskrnl/cache/section/data.c @@ -107,7 +107,7 @@ MiZeroFillSection PMEMORY_AREA MemoryArea; PMM_CACHE_SECTION_SEGMENT Segment; LARGE_INTEGER FileOffset = *FileOffsetPtr, End, FirstMapped; - DPRINT1("MiZeroFillSection(Address %x,Offset %x,Length %x)\n", Address, FileOffset.LowPart, Length); + DPRINT("MiZeroFillSection(Address %x,Offset %x,Length %x)\n", Address, FileOffset.LowPart, Length); AddressSpace = MmGetKernelAddressSpace(); MmLockAddressSpace(AddressSpace); MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address); @@ -178,13 +178,14 @@ _MiFlushMappedSection PFN_NUMBER Page; PPFN_NUMBER Pages; - DPRINT1("MiFlushMappedSection(%x,%08x,%x,%d,%s:%d)\n", BaseAddress, BaseOffset->LowPart, FileSize, WriteData, File, Line); + DPRINT("MiFlushMappedSection(%x,%08x,%x,%d,%s:%d)\n", BaseAddress, BaseOffset->LowPart, FileSize, WriteData, File, Line); MmLockAddressSpace(AddressSpace); MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, BaseAddress); - if (!MemoryArea || MemoryArea->Type != MEMORY_AREA_SECTION_VIEW) + if (!MemoryArea || MemoryArea->Type != MEMORY_AREA_CACHE) { MmUnlockAddressSpace(AddressSpace); + DPRINT("STATUS_NOT_MAPPED_DATA\n"); return STATUS_NOT_MAPPED_DATA; } BeginningAddress = PAGE_ROUND_DOWN((ULONG_PTR)MemoryArea->StartingAddress); @@ -206,6 +207,8 @@ _MiFlushMappedSection ASSERT(FALSE); } + DPRINT("Getting pages in range %08x-%08x\n", BeginningAddress, EndingAddress); + for (PageAddress = BeginningAddress; PageAddress < EndingAddress; PageAddress += PAGE_SIZE) diff --git a/reactos/ntoskrnl/cache/section/fault.c b/reactos/ntoskrnl/cache/section/fault.c index 81d6a0171e2..204c264b579 100644 --- a/reactos/ntoskrnl/cache/section/fault.c +++ b/reactos/ntoskrnl/cache/section/fault.c @@ -247,7 +247,7 @@ MiCowCacheSectionPage * Lock the segment */ MmLockCacheSectionSegment(Segment); - + /* * Find the offset of the page */ @@ -255,6 +255,44 @@ MiCowCacheSectionPage Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress + MemoryArea->Data.CacheData.ViewOffset.QuadPart; +#if 0 // XXX Cache sections are not CoW. For now, treat all access violations this way. + if ((!Segment->WriteCopy && + !MemoryArea->Data.CacheData.WriteCopyView) || + Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED) +#endif + { +#if 0 // XXX Cache sections don't have regions at present, which streamlines things + if (Region->Protect == PAGE_READWRITE || + Region->Protect == PAGE_EXECUTE_READWRITE) +#endif + { + DPRINTC("setting non-cow page %x %x:%x offset %x (%x) to writable\n", Segment, Process, PAddress, Offset.u.LowPart, MmGetPfnForProcess(Process, Address)); + if (Segment->FileObject) + { + DPRINTC("file %wZ\n", &Segment->FileObject->FileName); + } + ULONG Entry = MiGetPageEntryCacheSectionSegment(Segment, &Offset); + DPRINT("Entry %x\n", Entry); + if (Entry && + !IS_SWAP_FROM_SSE(Entry) && + PFN_FROM_SSE(Entry) == MmGetPfnForProcess(Process, Address)) { + MiSetPageEntryCacheSectionSegment(Segment, &Offset, DIRTY_SSE(Entry)); + } + MmSetPageProtect(Process, PAddress, PAGE_READWRITE); + MmUnlockCacheSectionSegment(Segment); + DPRINT("Done\n"); + return STATUS_SUCCESS; + } +#if 0 + else + { + DPRINT("Not supposed to be writable\n"); + MmUnlockCacheSectionSegment(Segment); + return STATUS_ACCESS_VIOLATION; + } +#endif + } + if (!Required->Page[0]) { SWAPENTRY SwapEntry; From 7a047a790264f615c3aff9c0e8485c337996879d Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Thu, 11 Nov 2010 13:05:52 +0000 Subject: [PATCH 013/132] [NTOS]: Fix another bug in the continuous memory allocation code, which would go off-by-one while looping the PFN entries for the allocation, and corrupt the PteFrame/PteAddress of an unrelated PFN entry. If this PFN was in the active lists, it would cause page table leaks and faults, if the page was on a free list, it would override the colored list backlink and corrupt the list, later causing unlinked pages to remain linked to the list. svn path=/trunk/; revision=49556 --- reactos/ntoskrnl/mm/ARM3/contmem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/contmem.c b/reactos/ntoskrnl/mm/ARM3/contmem.c index 744d8127aff..79eacda42a0 100644 --- a/reactos/ntoskrnl/mm/ARM3/contmem.c +++ b/reactos/ntoskrnl/mm/ARM3/contmem.c @@ -79,7 +79,6 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // if (MiIsPfnInUse(Pfn1)) { - //DPRINT1("In use: reset\n"); Length = 0; continue; } @@ -94,7 +93,6 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // // It does not, so bail out // - //DPRINT1("Doesn't match restrictions: reset\n"); continue; } @@ -368,7 +366,7 @@ MiFindContiguousMemory(IN PFN_NUMBER LowestPfn, /* Write the PTE address */ Pfn1->PteAddress = PointerPte; Pfn1->u4.PteFrame = PFN_FROM_PTE(MiAddressToPte(PointerPte++)); - } while (Pfn1++ < EndPfn); + } while (++Pfn1 < EndPfn); /* Return the address */ return BaseAddress; From 0bbcdaf47ff9d8cf77fe524893118d3d45f635a3 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Thu, 11 Nov 2010 13:08:41 +0000 Subject: [PATCH 014/132] [NTOS]: Fix a bug in MiRemovePageByColor which caused corruption of the page list and could lead to crashes, re-use of freed memory, assuming active memory was free, etc. svn path=/trunk/; revision=49557 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 3caf780b8c2..239b3138c34 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -265,7 +265,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, else { /* Set the list head's backlink instead */ - ListHead->Blink = OldFlink; + ListHead->Blink = OldBlink; } /* Check if the back entry is the list head */ From d5c3a8295f9de512a6e9607a82fd0b18d0176ae4 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Thu, 11 Nov 2010 13:13:05 +0000 Subject: [PATCH 015/132] [NTOS]: Use MI_PFN_ELEMENT in this code, as the extra checks done by MiGetPfnEntry are irrelevant and slow things down. [NTOS]: Remove some old ReactOS hacks before we had MMROSPFNDATA. svn path=/trunk/; revision=49558 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 67 ++++++++++++------------------ 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 239b3138c34..7d1f863c117 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -113,7 +113,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) if (OldFlink != LIST_HEAD) { /* It is not, so set the backlink of the actual entry, to our backlink */ - MiGetPfnEntry(OldFlink)->u2.Blink = OldBlink; + MI_PFN_ELEMENT(OldFlink)->u2.Blink = OldBlink; } else { @@ -125,7 +125,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) if (OldBlink != LIST_HEAD) { /* It is not, so set the backlink of the actual entry, to our backlink */ - MiGetPfnEntry(OldBlink)->u1.Flink = OldFlink; + MI_PFN_ELEMENT(OldBlink)->u1.Flink = OldFlink; } else { @@ -149,7 +149,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) if (ColorTable->Flink != LIST_HEAD) { /* And make the previous link point to the head now */ - MiGetPfnEntry(ColorTable->Flink)->u4.PteFrame = COLORED_LIST_HEAD; + MI_PFN_ELEMENT(ColorTable->Flink)->u4.PteFrame = COLORED_LIST_HEAD; } else { @@ -163,14 +163,14 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) ASSERT(Entry->u4.PteFrame != COLORED_LIST_HEAD); /* Make the back link point to whoever the next page is */ - Pfn1 = MiGetPfnEntry(Entry->u4.PteFrame); + Pfn1 = MI_PFN_ELEMENT(Entry->u4.PteFrame); Pfn1->OriginalPte.u.Long = Entry->OriginalPte.u.Long; /* Check if this page was pointing to the head */ if (Entry->OriginalPte.u.Long != LIST_HEAD) { /* Make the back link point to the head */ - Pfn1 = MiGetPfnEntry(Entry->OriginalPte.u.Long); + Pfn1 = MI_PFN_ELEMENT(Entry->OriginalPte.u.Long); Pfn1->u4.PteFrame = Entry->u4.PteFrame; } else @@ -235,7 +235,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, ASSERT(Color < MmSecondaryColors); /* Get the PFN entry */ - Pfn1 = MiGetPfnEntry(PageIndex); + Pfn1 = MI_PFN_ELEMENT(PageIndex); ASSERT(Pfn1->u3.e1.RemovalRequested == 0); ASSERT(Pfn1->u3.e1.Rom == 0); @@ -260,7 +260,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, if (OldFlink != LIST_HEAD) { /* It is not, so set the backlink of the actual entry, to our backlink */ - MiGetPfnEntry(OldFlink)->u2.Blink = OldBlink; + MI_PFN_ELEMENT(OldFlink)->u2.Blink = OldBlink; } else { @@ -272,7 +272,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, if (OldBlink != LIST_HEAD) { /* It is not, so set the backlink of the actual entry, to our backlink */ - MiGetPfnEntry(OldBlink)->u1.Flink = OldFlink; + MI_PFN_ELEMENT(OldBlink)->u1.Flink = OldFlink; } else { @@ -306,7 +306,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, else { /* The list is empty, so we are the first page */ - MiGetPfnEntry(ColorTable->Flink)->u4.PteFrame = COLORED_LIST_HEAD; + MI_PFN_ELEMENT(ColorTable->Flink)->u4.PteFrame = COLORED_LIST_HEAD; } /* One less page */ @@ -393,7 +393,7 @@ MiRemoveAnyPage(IN ULONG Color) PageIndex = MiRemovePageByColor(PageIndex, Color); /* Sanity checks */ - Pfn1 = MiGetPfnEntry(PageIndex); + Pfn1 = MI_PFN_ELEMENT(PageIndex); ASSERT((Pfn1->u3.e1.PageLocation == FreePageList) || (Pfn1->u3.e1.PageLocation == ZeroedPageList)); ASSERT(Pfn1->u3.e2.ReferenceCount == 0); @@ -458,13 +458,13 @@ MiRemoveZeroPage(IN ULONG Color) #endif /* Sanity checks */ - Pfn1 = MiGetPfnEntry(PageIndex); + Pfn1 = MI_PFN_ELEMENT(PageIndex); ASSERT((Pfn1->u3.e1.PageLocation == FreePageList) || (Pfn1->u3.e1.PageLocation == ZeroedPageList)); /* Remove the page from its list */ PageIndex = MiRemovePageByColor(PageIndex, Color); - ASSERT(Pfn1 == MiGetPfnEntry(PageIndex)); + ASSERT(Pfn1 == MI_PFN_ELEMENT(PageIndex)); /* Zero it, if needed */ if (Zero) MiZeroPhysicalPage(PageIndex); @@ -497,7 +497,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) (PageFrameIndex >= MmLowestPhysicalPage)); /* Get the PFN entry */ - Pfn1 = MiGetPfnEntry(PageFrameIndex); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); /* Sanity checks that a right kind of page is being inserted here */ ASSERT(Pfn1->u4.MustBeCached == 0); @@ -516,7 +516,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) if (LastPage != LIST_HEAD) { /* Link us with the previous page, so we're at the end now */ - MiGetPfnEntry(LastPage)->u1.Flink = PageFrameIndex; + MI_PFN_ELEMENT(LastPage)->u1.Flink = PageFrameIndex; } else { @@ -571,19 +571,15 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) /* Get the previous page */ Blink = (PMMPFN)ColorTable->Blink; - /* Make it link to us */ - Pfn1->u4.PteFrame = MiGetPfnEntryIndex(Blink); - - /* If there is an original pte, it should be an old link, NOT a ReactOS RMAP */ - ASSERT(Blink->u4.AweAllocation == FALSE); + /* Make it link to us, and link back to it */ Blink->OriginalPte.u.Long = PageFrameIndex; + Pfn1->u4.PteFrame = MiGetPfnEntryIndex(Blink); } /* Now initialize our own list pointers */ ColorTable->Blink = Pfn1; - /* If there is an original pte, it should be an old link, NOT a ReactOS RMAP */ - ASSERT(Pfn1->u4.AweAllocation == FALSE); + /* This page is now the last */ Pfn1->OriginalPte.u.Long = LIST_HEAD; /* And increase the count in the colored list */ @@ -627,7 +623,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead, (PageFrameIndex >= MmLowestPhysicalPage)); /* Page should be unused */ - Pfn1 = MiGetPfnEntry(PageFrameIndex); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); ASSERT(Pfn1->u3.e2.ReferenceCount == 0); ASSERT(Pfn1->u3.e1.Rom != 1); @@ -651,7 +647,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead, if (Flink != LIST_HEAD) { /* It wasn't, so update the backlink of the previous head page */ - Pfn2 = MiGetPfnEntry(Flink); + Pfn2 = MI_PFN_ELEMENT(Flink); Pfn2->u2.Blink = PageFrameIndex; } else @@ -691,9 +687,6 @@ MiInsertPageInList(IN PMMPFNLIST ListHead, /* Get the old head */ Flink = ColorHead->Flink; - /* If there is an original pte, it should be an old link, NOT a ReactOS RMAP */ - ASSERT(Pfn1->u4.AweAllocation == FALSE); - /* Make this page point back to the list, and point forwards to the old head */ Pfn1->OriginalPte.u.Long = Flink; Pfn1->u4.PteFrame = COLORED_LIST_HEAD; @@ -705,7 +698,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead, if (Flink != LIST_HEAD) { /* No, so make the old head point to this page */ - Pfn2 = MiGetPfnEntry(Flink); + Pfn2 = MI_PFN_ELEMENT(Flink); Pfn2->u4.PteFrame = PageFrameIndex; } else @@ -737,7 +730,7 @@ MiInitializePfn(IN PFN_NUMBER PageFrameIndex, ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); /* Setup the PTE */ - Pfn1 = MiGetPfnEntry(PageFrameIndex); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); Pfn1->PteAddress = PointerPte; /* Check if this PFN is part of a valid address space */ @@ -788,7 +781,7 @@ MiInitializePfn(IN PFN_NUMBER PageFrameIndex, Pfn1->u4.PteFrame = PageFrameIndex; /* Increase its share count so we don't get rid of it */ - Pfn1 = MiGetPfnEntry(PageFrameIndex); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); Pfn1->u2.ShareCount++; } @@ -842,8 +835,8 @@ MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex) { ASSERT(PageFrameIndex > 0); - ASSERT(MiGetPfnEntry(PageFrameIndex) != NULL); - ASSERT(Pfn1 == MiGetPfnEntry(PageFrameIndex)); + ASSERT(MI_PFN_ELEMENT(PageFrameIndex) != NULL); + ASSERT(Pfn1 == MI_PFN_ELEMENT(PageFrameIndex)); ASSERT(MI_IS_ROS_PFN(Pfn1) == FALSE); /* Page must be in-use */ @@ -880,13 +873,7 @@ MiDecrementShareCount(IN PMMPFN Pfn1, /* Clear the last reference */ Pfn1->u3.e2.ReferenceCount = 0; - - /* - * OriginalPte is used by AweReferenceCount in ReactOS, but either - * ways we shouldn't be seeing RMAP entries at this point - */ ASSERT(Pfn1->OriginalPte.u.Soft.Prototype == 0); - ASSERT(Pfn1->u4.AweAllocation == FALSE); /* Mark the page temporarily as valid, we're going to make it free soon */ Pfn1->u3.e1.PageLocation = ActiveAndValid; @@ -912,7 +899,7 @@ MiDecrementReferenceCount(IN PMMPFN Pfn1, /* Sanity checks on the page */ ASSERT(PageFrameIndex < MmHighestPhysicalPage); - ASSERT(Pfn1 == MiGetPfnEntry(PageFrameIndex)); + ASSERT(Pfn1 == MI_PFN_ELEMENT(PageFrameIndex)); ASSERT(Pfn1->u3.e2.ReferenceCount != 0); /* Dereference the page, bail out if it's still alive */ @@ -954,7 +941,7 @@ MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, PMMPFN Pfn1; /* Setup the PTE */ - Pfn1 = MiGetPfnEntry(PageFrameIndex); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); Pfn1->PteAddress = PointerPte; /* Make this a software PTE */ @@ -975,7 +962,7 @@ MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, Pfn1->u4.PteFrame = PteFrame; /* Increase its share count so we don't get rid of it */ - Pfn1 = MiGetPfnEntry(PteFrame); + Pfn1 = MI_PFN_ELEMENT(PteFrame); Pfn1->u2.ShareCount++; } } From ef4089933ae4ebfd1a2523bd3b27591ba49fccc6 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Thu, 11 Nov 2010 13:15:40 +0000 Subject: [PATCH 016/132] [NTOS]: Start using colored pages. This will help performance on real systems significantly as cache is now taken into account by the memory manager. Also radically changes the way page allocations are given out and creates a less uniform physical memory layout. The fact this now works means that the PFN lists are finally now sane. svn path=/trunk/; revision=49559 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 7d1f863c117..9c2f5bdbe18 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -356,18 +356,15 @@ MiRemoveAnyPage(IN ULONG Color) ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); ASSERT(MmAvailablePages != 0); ASSERT(Color < MmSecondaryColors); -#if 0 + /* Check the colored free list */ PageIndex = MmFreePagesByColor[FreePageList][Color].Flink; - DPRINT1("Found free page: %lx\n", PageIndex); if (PageIndex == LIST_HEAD) { /* Check the colored zero list */ PageIndex = MmFreePagesByColor[ZeroedPageList][Color].Flink; - DPRINT1("Found zero page: %lx\n", PageIndex); if (PageIndex == LIST_HEAD) { -#endif /* Check the free list */ ASSERT_LIST_INVARIANT(&MmFreePageListHead); PageIndex = MmFreePageListHead.Flink; @@ -385,10 +382,9 @@ MiRemoveAnyPage(IN ULONG Color) ASSERT(MmZeroedPageListHead.Total == 0); } } -#if 0 } } -#endif + /* Remove the page from its list */ PageIndex = MiRemovePageByColor(PageIndex, Color); @@ -419,11 +415,9 @@ MiRemoveZeroPage(IN ULONG Color) ASSERT(Color < MmSecondaryColors); /* Check the colored zero list */ -#if 0 PageIndex = MmFreePagesByColor[ZeroedPageList][Color].Flink; if (PageIndex == LIST_HEAD) { -#endif /* Check the zero list */ ASSERT_LIST_INVARIANT(&MmZeroedPageListHead); PageIndex = MmZeroedPageListHead.Flink; @@ -433,12 +427,11 @@ MiRemoveZeroPage(IN ULONG Color) /* This means there's no zero pages, we have to look for free ones */ ASSERT(MmZeroedPageListHead.Total == 0); Zero = TRUE; -#if 0 + /* Check the colored free list */ PageIndex = MmFreePagesByColor[FreePageList][Color].Flink; if (PageIndex == LIST_HEAD) { -#endif /* Check the free list */ ASSERT_LIST_INVARIANT(&MmFreePageListHead); PageIndex = MmFreePageListHead.Flink; @@ -449,13 +442,9 @@ MiRemoveZeroPage(IN ULONG Color) /* FIXME: Should check the standby list */ ASSERT(MmZeroedPageListHead.Total == 0); } -#if 0 } -#endif } -#if 0 } -#endif /* Sanity checks */ Pfn1 = MI_PFN_ELEMENT(PageIndex); From ea5d462bdf525589a8deee87561c348088870a68 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 13 Nov 2010 19:48:13 +0000 Subject: [PATCH 017/132] [FREELDR] Convert most of the trap and blue screen code from asm to C, use KTRAP_FRAME and KSPECIAL_REGISTERS on the stack, instead of using a bunch of global variables. Convert multiply used asm code chunks into macros. Use intel syntax for remaining asm. 135 lines of C + 178 lines of asm, instead of 942 lines of asm svn path=/trunk/; revision=49573 --- .../boot/freeldr/freeldr/arch/i386/i386bug.c | 135 +++ .../boot/freeldr/freeldr/arch/i386/i386trap.S | 999 ++---------------- .../boot/freeldr/freeldr/freeldr_arch.rbuild | 1 + 3 files changed, 253 insertions(+), 882 deletions(-) create mode 100644 reactos/boot/freeldr/freeldr/arch/i386/i386bug.c diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386bug.c b/reactos/boot/freeldr/freeldr/arch/i386/i386bug.c new file mode 100644 index 00000000000..989ce6ec9e1 --- /dev/null +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386bug.c @@ -0,0 +1,135 @@ + +#include + +#define NDEBUG +#include + +typedef struct _FRAME +{ + struct _FRAME *Next; + void *Address; +} FRAME; + +char *i386ExceptionDescriptionText[] = +{ + "Exception 00: DIVIDE BY ZERO\n\n", + "Exception 01: DEBUG EXCEPTION\n\n", + "Exception 02: NON-MASKABLE INTERRUPT EXCEPTION\n\n", + "Exception 03: BREAKPOINT (INT 3)\n\n", + "Exception 04: OVERFLOW\n\n", + "Exception 05: BOUND EXCEPTION\n\n", + "Exception 06: INVALID OPCODE\n\n", + "Exception 07: FPU NOT AVAILABLE\n\n", + "Exception 08: DOUBLE FAULT\n\n", + "Exception 09: COPROCESSOR SEGMENT OVERRUN\n\n", + "Exception 0A: INVALID TSS\n\n", + "Exception 0B: SEGMENT NOT PRESENT\n\n", + "Exception 0C: STACK EXCEPTION\n\n", + "Exception 0D: GENERAL PROTECTION FAULT\n\n", + "Exception 0E: PAGE FAULT\n\n", + "Exception 0F: Reserved\n\n", + "Exception 10: COPROCESSOR ERROR\n\n", + "Exception 11: ALIGNMENT CHECK\n\n", + "Exception 12: MACHINE CHECK\n\n" +}; + +#define SCREEN_ATTR 0x1f +void +i386PrintChar(char chr, ULONG x, ULONG y) +{ + MachVideoPutChar(chr, SCREEN_ATTR, x, y); +} + +/* Used to store the current X and Y position on the screen */ +ULONG i386_ScreenPosX = 0; +ULONG i386_ScreenPosY = 0; + +void +i386PrintText(char *pszText) +{ + char chr; + while (1) + { + chr = *pszText++; + + if (chr == 0) break; + if (chr == '\n') + { + i386_ScreenPosY++; + i386_ScreenPosX = 0; + continue; + } + + MachVideoPutChar(chr, SCREEN_ATTR, i386_ScreenPosX, i386_ScreenPosY); + i386_ScreenPosX++; + } +} + +void +PrintText(const char *format, ...) +{ + va_list argptr; + char buffer[256]; + + va_start(argptr, format); + _vsnprintf(buffer, sizeof(buffer), format, argptr); + buffer[sizeof(buffer) - 1] = 0; + va_end(argptr); + i386PrintText(buffer); +} + +void +i386PrintFrames(PKTRAP_FRAME TrapFrame) +{ + FRAME *Frame; + + PrintText("Frames:\n"); + + for (Frame = (FRAME*)TrapFrame->Ebp; + Frame != 0 && (ULONG_PTR)Frame < STACK32ADDR; + Frame = Frame->Next) + { + PrintText("%p ", Frame->Address); + } +} + +void +NTAPI +i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGISTERS Special) +{ + MachVideoClearScreen(SCREEN_ATTR); + i386_ScreenPosX = 0; + i386_ScreenPosY = 0; + + PrintText("An error occured in FreeLoader\n" + VERSION"\n" + "Report this error to the ReactOS Development mailing list \n\n" + "%s\n", i386ExceptionDescriptionText[TrapIndex]); + + PrintText("EAX: %.8lx ESP: %.8lx CR0: %.8lx DR0: %.8lx\n", + TrapFrame->Eax, TrapFrame->HardwareEsp, Special->Cr0, TrapFrame->Dr0); + PrintText("EBX: %.8lx EBP: %.8lx CR1: ???????? DR1: %.8lx\n", + TrapFrame->Ebx, TrapFrame->Ebp, TrapFrame->Dr1); + PrintText("ECX: %.8lx ESI: %.8lx CR2: %.8lx DR2: %.8lx\n", + TrapFrame->Ecx, TrapFrame->Esi, Special->Cr2, TrapFrame->Dr2); + PrintText("EDX: %.8lx EDI: %.8lx CR3: %.8lx DR3: %.8lx\n", + TrapFrame->Edx, TrapFrame->Edi, Special->Cr3, TrapFrame->Dr3); + PrintText(" DR6: %.8lx\n", + TrapFrame->Dr6); + PrintText(" DR7: %.8lx\n\n", + TrapFrame->Dr7); + PrintText("CS: %.4lx EIP: %.8lx\n", + TrapFrame->SegCs, TrapFrame->Eip); + PrintText("DS: %.4lx ERROR CODE: %.8lx\n", + TrapFrame->SegDs, TrapFrame->Eip); + PrintText("ES: %.4lx EFLAGS: %.8lx\n", + TrapFrame->SegEs, TrapFrame->EFlags); + PrintText("FS: %.4lx GDTR Base: %.8lx Limit: %.4x\n", + TrapFrame->SegFs, Special->Gdtr.Base, Special->Gdtr.Limit); + PrintText("GS: %.4lx IDTR Base: %.8lx Limit: %.4x\n", + TrapFrame->SegGs, Special->Idtr.Base, Special->Idtr.Limit); + PrintText("SS: %.4lx LDTR: %.4lx TR: %.4lx\n\n", + TrapFrame->HardwareSegSs, Special->Ldtr, Special->Idtr.Limit); + + i386PrintFrames(TrapFrame); // Display frames +} diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S b/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S index 833fcc37104..be5c7de3ce9 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +.intel_syntax noprefix .text .code16 @@ -27,244 +28,67 @@ #define SCREEN_ATTR 0x1f /* Bright white on blue background */ .macro SAVE_CPU_REGS - movl %eax,i386_EAX - movl %ebx,i386_EBX - movl %ecx,i386_ECX - movl %edx,i386_EDX - movl %esp,i386_ESP - movl %ebp,i386_EBP - movl %esi,i386_ESI - movl %edi,i386_EDI - movw %ds,%ax - movw %ax,i386_DS - movw %es,%ax - movw %ax,i386_ES - movw %fs,%ax - movw %ax,i386_FS - movw %gs,%ax - movw %ax,i386_GS - movw %ss,%ax - movw %ax,i386_SS - popl %eax - movl %eax,i386_EIP - popl %eax - movw %ax,i386_CS - popl %eax - movl %eax,i386_EFLAGS - movl %cr0,%eax - movl %eax,i386_CR0 - //movl %cr1,%eax - //movl %eax,i386_CR1 - movl %cr2,%eax - movl %eax,i386_CR2 - movl %cr3,%eax - movl %eax,i386_CR3 - movl %dr0,%eax - movl %eax,i386_DR0 - movl %dr1,%eax - movl %eax,i386_DR1 - movl %dr2,%eax - movl %eax,i386_DR2 - movl %dr3,%eax - movl %eax,i386_DR3 - movl %dr6,%eax - movl %eax,i386_DR6 - movl %dr7,%eax - movl %eax,i386_DR7 - sgdt i386_GDTR - sidt i386_IDTR - sldt i386_LDTR - str i386_TR + /* push the rest of the KTRAP_FRAME */ + push ebp + push ebx + push esi + push edi + push fs + push 0 // ExceptionList + push 0 // PreviousPreviousMode + push eax + push ecx + push edx + push ds + push es + push gs + mov eax, dr7 + push eax + mov eax, dr6 + push eax + mov eax, dr3 + push eax + mov eax, dr2 + push eax + mov eax, dr1 + push eax + mov eax, dr0 + push eax + sub esp, 6 * 4 + + /* push KSPECIAL_REGISTERS */ + /* Gdtr, Idtr, Tr, Ldtr, Reserved */ + sub esp, 44 + sgdt [esp] + sidt [esp + 8] + str [esp + 16] + sldt [esp + 18] + mov eax, dr7; + push eax + mov eax, dr6; + push eax + mov eax, dr3; + push eax + mov eax, dr2; + push eax + mov eax, dr1; + push eax + mov eax, dr0; + push eax + mov eax, cr4; + push eax + mov eax, cr3; + push eax + mov eax, cr2; + push eax + mov eax, cr0; + push eax .endm - - -i386ExceptionHandlerText: - .ascii "An error occured in FreeLoader\n" - .ascii VERSION - .ascii "\n" - .asciz "Report this error to the ReactOS Development mailing list \n\n" - -i386DivideByZeroText: - .asciz "Exception 00: DIVIDE BY ZERO\n\n" -i386DebugExceptionText: - .asciz "Exception 01: DEBUG EXCEPTION\n\n" -i386NMIExceptionText: - .asciz "Exception 02: NON-MASKABLE INTERRUPT EXCEPTION\n\n" -i386BreakpointText: - .asciz "Exception 03: BREAKPOINT (INT 3)\n\n" -i386OverflowText: - .asciz "Exception 04: OVERFLOW\n\n" -i386BoundExceptionText: - .asciz "Exception 05: BOUND EXCEPTION\n\n" -i386InvalidOpcodeText: - .asciz "Exception 06: INVALID OPCODE\n\n" -i386FPUNotAvailableText: - .asciz "Exception 07: FPU NOT AVAILABLE\n\n" -i386DoubleFaultText: - .asciz "Exception 08: DOUBLE FAULT\n\n" -i386CoprocessorSegmentText: - .asciz "Exception 09: COPROCESSOR SEGMENT OVERRUN\n\n" -i386InvalidTSSText: - .asciz "Exception 0A: INVALID TSS\n\n" -i386SegmentNotPresentText: - .asciz "Exception 0B: SEGMENT NOT PRESENT\n\n" -i386StackExceptionText: - .asciz "Exception 0C: STACK EXCEPTION\n\n" -i386GeneralProtectionFaultText: - .asciz "Exception 0D: GENERAL PROTECTION FAULT\n\n" -i386PageFaultText: - .asciz "Exception 0E: PAGE FAULT\n\n" -i386CoprocessorErrorText: - .asciz "Exception 10: COPROCESSOR ERROR\n\n" -i386AlignmentCheckText: - .asciz "Exception 11: ALIGNMENT CHECK\n\n" -i386MachineCheckText: - .asciz "Exception 12: MACHINE CHECK\n\n" - -i386_EAX_Text: - .asciz "EAX: " -i386_EBX_Text: - .asciz "EBX: " -i386_ECX_Text: - .asciz "ECX: " -i386_EDX_Text: - .asciz "EDX: " -i386_ESP_Text: - .asciz " ESP: " -i386_EBP_Text: - .asciz " EBP: " -i386_ESI_Text: - .asciz " ESI: " -i386_EDI_Text: - .asciz " EDI: " -i386_CS_Text: - .asciz "CS: " -i386_DS_Text: - .asciz "DS: " -i386_ES_Text: - .asciz "ES: " -i386_FS_Text: - .asciz "FS: " -i386_GS_Text: - .asciz "GS: " -i386_SS_Text: - .asciz "SS: " -i386_EFLAGS_Text: - .asciz " EFLAGS: " -i386_EIP_Text: - .asciz " EIP: " -i386_ERROR_CODE_Text: - .asciz " ERROR CODE: " -i386_CR0_Text: - .asciz " CR0: " -i386_CR1_Text: - .asciz " CR1: " -i386_CR2_Text: - .asciz " CR2: " -i386_CR3_Text: - .asciz " CR3: " -i386_DR0_Text: - .asciz " DR0: " -i386_DR1_Text: - .asciz " DR1: " -i386_DR2_Text: - .asciz " DR2: " -i386_DR3_Text: - .asciz " DR3: " -i386_DR6_Text: - .asciz " DR6: " -i386_DR7_Text: - .asciz " DR7: " -i386_GDTR_Text: - .asciz " GDTR Base: " -i386_IDTR_Text: - .asciz " IDTR Base: " -i386_Limit_Text: - .asciz " Limit: " -i386_LDTR_Text: - .asciz " LDTR: " -i386_TR_Text: - .asciz " TR: " - -i386FramesText: - .asciz "Frames:\n" - /* Set by each exception handler to the address of the description text */ -i386ExceptionDescriptionText: +i386ExceptionIndex: .long 0 -/* Used to store the contents of all the registers when an exception occurs */ -i386_EAX: - .long 0 -i386_EBX: - .long 0 -i386_ECX: - .long 0 -i386_EDX: - .long 0 -i386_ESP: - .long 0 -i386_EBP: - .long 0 -i386_ESI: - .long 0 -i386_EDI: - .long 0 -i386_CS: - .word 0 -i386_DS: - .word 0 -i386_ES: - .word 0 -i386_FS: - .word 0 -i386_GS: - .word 0 -i386_SS: - .word 0 -i386_EFLAGS: - .long 0 -i386_EIP: - .long 0 -i386_ERROR_CODE: - .long 0 -i386_CR0: - .long 0 -i386_CR1: - .long 0 -i386_CR2: - .long 0 -i386_CR3: - .long 0 -i386_DR0: - .long 0 -i386_DR1: - .long 0 -i386_DR2: - .long 0 -i386_DR3: - .long 0 -i386_DR6: - .long 0 -i386_DR7: - .long 0 -i386_GDTR: - .word 0 - .long 0 -i386_IDTR: - .word 0 - .long 0 -i386_LDTR: - .word 0 -i386_TR: - .word 0 - -/* Used to store the current X and Y position on the screen */ -i386_ScreenPosX: - .long 0 -i386_ScreenPosY: - .long 0 /************************************************************************/ i386CommonExceptionHandler: @@ -272,177 +96,11 @@ i386CommonExceptionHandler: SAVE_CPU_REGS - pushl $SCREEN_ATTR - call _MachVideoClearScreen - add $4,%esp - - movl $i386ExceptionHandlerText,%esi - call i386PrintText - - movl i386ExceptionDescriptionText,%esi - call i386PrintText - - movl $i386_EAX_Text,%esi - call i386PrintText - movl i386_EAX,%eax - call i386PrintHexDword // Display EAX - movl $i386_ESP_Text,%esi - call i386PrintText - movl i386_ESP,%eax - call i386PrintHexDword // Display ESP - movl $i386_CR0_Text,%esi - call i386PrintText - movl i386_CR0,%eax - call i386PrintHexDword // Display CR0 - movl $i386_DR0_Text,%esi - call i386PrintText - movl i386_DR0,%eax - call i386PrintHexDword // Display DR0 - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_EBX_Text,%esi - call i386PrintText - movl i386_EBX,%eax - call i386PrintHexDword // Display EBX - movl $i386_EBP_Text,%esi - call i386PrintText - movl i386_EBP,%eax - call i386PrintHexDword // Display EBP - movl $i386_CR1_Text,%esi - call i386PrintText - movl i386_CR1,%eax - call i386PrintHexDword // Display CR1 - movl $i386_DR1_Text,%esi - call i386PrintText - movl i386_DR1,%eax - call i386PrintHexDword // Display DR1 - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_ECX_Text,%esi - call i386PrintText - movl i386_ECX,%eax - call i386PrintHexDword // Display ECX - movl $i386_ESI_Text,%esi - call i386PrintText - movl i386_ESI,%eax - call i386PrintHexDword // Display ESI - movl $i386_CR2_Text,%esi - call i386PrintText - movl i386_CR2,%eax - call i386PrintHexDword // Display CR2 - movl $i386_DR2_Text,%esi - call i386PrintText - movl i386_DR2,%eax - call i386PrintHexDword // Display DR2 - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_EDX_Text,%esi - call i386PrintText - movl i386_EDX,%eax - call i386PrintHexDword // Display EDX - movl $i386_EDI_Text,%esi - call i386PrintText - movl i386_EDI,%eax - call i386PrintHexDword // Display EDI - movl $i386_CR3_Text,%esi - call i386PrintText - movl i386_CR3,%eax - call i386PrintHexDword // Display CR3 - movl $i386_DR3_Text,%esi - call i386PrintText - movl i386_DR3,%eax - call i386PrintHexDword // Display DR3 - incl i386_ScreenPosY - movl $55,i386_ScreenPosX - movl $i386_DR6_Text,%esi - call i386PrintText - movl i386_DR6,%eax - call i386PrintHexDword // Display DR6 - incl i386_ScreenPosY - movl $55,i386_ScreenPosX - movl $i386_DR7_Text,%esi - call i386PrintText - movl i386_DR7,%eax - call i386PrintHexDword // Display DR7 - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - incl i386_ScreenPosY - movl $i386_CS_Text,%esi - call i386PrintText - movw i386_CS,%ax - call i386PrintHexWord // Display CS - movl $i386_EIP_Text,%esi - call i386PrintText - movl i386_EIP,%eax - call i386PrintHexDword // Display EIP - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_DS_Text,%esi - call i386PrintText - movw i386_DS,%ax - call i386PrintHexWord // Display DS - movl $i386_ERROR_CODE_Text,%esi - call i386PrintText - movl i386_ERROR_CODE,%eax - call i386PrintHexDword // Display ERROR CODE - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_ES_Text,%esi - call i386PrintText - movw i386_ES,%ax - call i386PrintHexWord // Display ES - movl $i386_EFLAGS_Text,%esi - call i386PrintText - movl i386_EFLAGS,%eax - call i386PrintHexDword // Display EFLAGS - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_FS_Text,%esi - call i386PrintText - movw i386_FS,%ax - call i386PrintHexWord // Display FS - movl $i386_GDTR_Text,%esi - call i386PrintText - movl i386_GDTR+2,%eax - call i386PrintHexDword // Display GDTR Base - movl $i386_Limit_Text,%esi - call i386PrintText - movw i386_GDTR,%ax - call i386PrintHexWord // Display GDTR Limit - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_GS_Text,%esi - call i386PrintText - movw i386_GS,%ax - call i386PrintHexWord // Display GS - movl $i386_IDTR_Text,%esi - call i386PrintText - movl i386_IDTR+2,%eax - call i386PrintHexDword // Display IDTR Base - movl $i386_Limit_Text,%esi - call i386PrintText - movw i386_IDTR,%ax - call i386PrintHexWord // Display IDTR Limit - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - movl $i386_SS_Text,%esi - call i386PrintText - movw i386_SS,%ax - call i386PrintHexWord // Display SS - movl $i386_LDTR_Text,%esi - call i386PrintText - movw i386_LDTR,%ax - call i386PrintHexWord // Display LDTR - movl $i386_TR_Text,%esi - call i386PrintText - movw i386_TR,%ax - call i386PrintHexWord // Display TR - movl $0,i386_ScreenPosX - incl i386_ScreenPosY - incl i386_ScreenPosY - call i386PrintFrames // Display frames - incl i386_ScreenPosY - incl i386_ScreenPosY + lea eax, [esp + (21 * 4)] // KTRAP_FRAME + push esp // KSPECIAL_REGISTERS + push eax + push i386ExceptionIndex + call _i386PrintExceptionText@12 cli i386ExceptionHandlerHang: @@ -451,492 +109,69 @@ i386ExceptionHandlerHang: iret -i386PrintFrames: - movl $0,i386_ScreenPosX - movl $i386FramesText,%esi - call i386PrintText +.macro TRAP_STUB function, index + EXTERN(\function) + push 0 // Fake error code + mov dword ptr i386ExceptionIndex, \index + jmp i386CommonExceptionHandler +.endm - movl i386_EBP,%edi -printnextframe: - test %edi,%edi - je nomoreframes - movl $STACK32ADDR,%eax - cmpl %edi,%eax - jbe nomoreframes - movl 4(%edi),%eax - pushl %edi - call i386PrintHexDword // Display frame - popl %edi - incl i386_ScreenPosX - incl i386_ScreenPosX - movl 0(%edi),%edi - jmp printnextframe -nomoreframes: - ret +.macro TRAP_STUB2 function, index + EXTERN(\function) + mov dword ptr i386ExceptionIndex, \index + jmp i386CommonExceptionHandler +.endm /************************************************************************/ -/* AL = Char to display */ -/************************************************************************/ -i386PrintChar: - .code32 - - pushl i386_ScreenPosY - pushl i386_ScreenPosX - pushl $SCREEN_ATTR - andl $0xff,%eax - pushl %eax - call _MachVideoPutChar - addl $16,%esp - - ret - -/************************************************************************/ -/* ESI = Address of text to display */ -/************************************************************************/ -i386PrintText: - .code32 - -i386PrintTextLoop: - lodsb - - // Check for end of string char - cmp $0,%al - je i386PrintTextDone - - // Check for newline char - cmp $0x0a,%al - jne i386PrintTextLoop2 - incl i386_ScreenPosY - movl $0,i386_ScreenPosX - jmp i386PrintTextLoop - -i386PrintTextLoop2: - call i386PrintChar - incl i386_ScreenPosX - - jmp i386PrintTextLoop - -i386PrintTextDone: - - ret - -/************************************************************************/ -/* Prints the value in EAX on the screen in hex */ -/************************************************************************/ -i386PrintHexDword: - .code32 - - call i386PrintHex1 - -i386PrintHex1: - call i386PrintHex2 -i386PrintHex2: - call i386PrintHex3 -i386PrintHex3: - movb $4,%cl - rol %cl,%eax - push %eax - andb $0x0f,%al - movl $i386PrintHexTable,%ebx - xlat /*$i386PrintHexTable*/ - call i386PrintChar - incl i386_ScreenPosX - pop %eax - - ret - -i386PrintHexTable: - .ascii "0123456789ABCDEF" - -/************************************************************************/ -/* Prints the value in AX on the screen in hex */ -/************************************************************************/ -i386PrintHexWord: - .code32 - - call i386PrintHexWord1 -i386PrintHexWord1: - call i386PrintHexWord2 -i386PrintHexWord2: - movb $4,%cl - rol %cl,%ax - push %eax - andb $0x0f,%al - movl $i386PrintHexTable,%ebx - xlat /*$i386PrintHexTable*/ - call i386PrintChar - incl i386_ScreenPosX - pop %eax - - ret - -/************************************************************************/ -/* Prints the value in AL on the screen in hex */ -/************************************************************************/ -i386PrintHexByte: - .code32 - - call i386PrintHexByte1 -i386PrintHexByte1: - movb $4,%cl - rol %cl,%al - push %eax - andb $0x0f,%al - movl $i386PrintHexTable,%ebx - xlat /*$i386PrintHexTable*/ - call i386PrintChar - incl i386_ScreenPosX - pop %eax - - ret - -/************************************************************************/ -EXTERN(i386DivideByZero) - .code32 - - movl $i386DivideByZeroText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386DebugException) - .code32 - - movl $i386DebugExceptionText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386NMIException) - .code32 - - movl $i386NMIExceptionText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386Breakpoint) - .code32 - - movl $i386BreakpointText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386Overflow) - .code32 - - movl $i386OverflowText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386BoundException) - .code32 - - movl $i386BoundExceptionText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386InvalidOpcode) - .code32 - - movl $i386InvalidOpcodeText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386FPUNotAvailable) - .code32 - - movl $i386FPUNotAvailableText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386DoubleFault) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386DoubleFaultText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386CoprocessorSegment) - .code32 - - movl $i386CoprocessorSegmentText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386InvalidTSS) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386InvalidTSSText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386SegmentNotPresent) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386SegmentNotPresentText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386StackException) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386StackExceptionText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386GeneralProtectionFault) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386GeneralProtectionFaultText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386PageFault) - .code32 - - popl %eax - movl %eax,i386_ERROR_CODE - - movl $i386PageFaultText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386CoprocessorError) - .code32 - - movl $i386CoprocessorErrorText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386AlignmentCheck) - .code32 - - movl $i386AlignmentCheckText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler - -/************************************************************************/ -EXTERN(i386MachineCheck) - .code32 - - movl $i386MachineCheckText,i386ExceptionDescriptionText - jmp i386CommonExceptionHandler +TRAP_STUB i386DivideByZero, 0 +TRAP_STUB i386DebugException, 1 +TRAP_STUB i386NMIException, 2 +TRAP_STUB i386Breakpoint, 3 +TRAP_STUB i386Overflow, 4 +TRAP_STUB i386BoundException, 5 +TRAP_STUB i386InvalidOpcode, 6 +TRAP_STUB i386FPUNotAvailable, 7 +TRAP_STUB2 i386DoubleFault, 8 +TRAP_STUB i386CoprocessorSegment, 9 +TRAP_STUB2 i386InvalidTSS, 10 +TRAP_STUB2 i386SegmentNotPresent, 11 +TRAP_STUB2 i386StackException, 12 +TRAP_STUB2 i386GeneralProtectionFault, 13 +TRAP_STUB2 i386PageFault, 14 +// 15 is reserved +TRAP_STUB i386CoprocessorError, 16 +TRAP_STUB i386AlignmentCheck, 17 +TRAP_STUB i386MachineCheck, 18 +TRAP_STUB i386SimdFloatError, 19 /************************************************************************ * DEBUGGING SUPPORT FUNCTIONS ************************************************************************/ -EXTERN(_INSTRUCTION_BREAKPOINT1) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr0 - movl %dr7,%eax - andl $0xfff0ffff,%eax - orl $0x00000303,%eax - movl %eax,%dr7 - - popl %eax +.macro BREAKPOINT_TEPLATE functionname, mask1, mask2 + EXTERN(\functionname) + push eax + mov eax, [esp + 8] + mov dr3, eax + mov eax, dr7 + and eax, \mask1 + or eax, \mask2 + mov dr7, eax + pop eax ret +.endm + +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT1, 0xfff0ffff, 0x00000303 +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT1, 0xfff0ffff, 0x00030303 +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT1, 0xfff0ffff, 0x00010303 +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT2, 0xff0fffff, 0x0000030c +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT2, 0xff0fffff, 0x0030030c +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT2, 0xff0fffff, 0x0010030c +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT3, 0xf0ffffff, 0x00000330 +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT3, 0xf0ffffff, 0x03000330 +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT3, 0xf0ffffff, 0x01000330 +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT4, 0x0fffffff, 0x000003c0 +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT4, 0x0fffffff, 0x300003c0 +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT4, 0x0fffffff, 0x100003c0 -EXTERN(_MEMORY_READWRITE_BREAKPOINT1) - .code32 - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr0 - movl %dr7,%eax - andl $0xfff0ffff,%eax - orl $0x00030303,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_WRITE_BREAKPOINT1) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr0 - movl %dr7,%eax - andl $0xfff0ffff,%eax - orl $0x00010303,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_INSTRUCTION_BREAKPOINT2) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr1 - movl %dr7,%eax - andl $0xff0fffff,%eax - orl $0x0000030c,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_READWRITE_BREAKPOINT2) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr1 - movl %dr7,%eax - andl $0xff0fffff,%eax - orl $0x0030030c,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_WRITE_BREAKPOINT2) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr1 - movl %dr7,%eax - andl $0xff0fffff,%eax - orl $0x0010030c,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_INSTRUCTION_BREAKPOINT3) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr2 - movl %dr7,%eax - andl $0xf0ffffff,%eax - orl $0x00000330,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_READWRITE_BREAKPOINT3) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr2 - movl %dr7,%eax - andl $0xf0ffffff,%eax - orl $0x03000330,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_WRITE_BREAKPOINT3) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr2 - movl %dr7,%eax - andl $0xf0ffffff,%eax - orl $0x01000330,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_INSTRUCTION_BREAKPOINT4) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr3 - movl %dr7,%eax - andl $0x0fffffff,%eax - orl $0x000003c0,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_READWRITE_BREAKPOINT4) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr3 - movl %dr7,%eax - andl $0x0fffffff,%eax - orl $0x300003c0,%eax - movl %eax,%dr7 - - popl %eax - - ret - -EXTERN(_MEMORY_WRITE_BREAKPOINT4) - .code32 - - pushl %eax - - movl 8(%esp),%eax - - movl %eax,%dr3 - movl %dr7,%eax - andl $0x0fffffff,%eax - orl $0x100003c0,%eax - movl %eax,%dr7 - - popl %eax - - ret diff --git a/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild b/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild index 6aa231c258a..3badf7200be 100644 --- a/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild +++ b/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild @@ -21,6 +21,7 @@ hwacpi.c hwapm.c hwpci.c + i386bug.c i386disk.c i386rtl.c i386vid.c From 31efb355c91abef898259a9297686de9bc40b32d Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 14 Nov 2010 00:27:38 +0000 Subject: [PATCH 018/132] [Win32k] - Fixed WaitForInputIdle, finally!, passed all the wine tests for it. - Moved Get/Peek message to the new all in one support routine. - Foreground hook hits one out of five, this needs more research. - Attempted to workout synchronizing issues with low level and regular hooks. svn path=/trunk/; revision=49579 --- .../subsystems/win32/win32k/main/dllmain.c | 9 + .../subsystems/win32/win32k/ntuser/message.c | 250 +++++++++--------- .../subsystems/win32/win32k/ntuser/msgqueue.c | 34 --- 3 files changed, 138 insertions(+), 155 deletions(-) diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 42efcf9ea0e..5ed49f112e8 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -103,6 +103,8 @@ Win32kProcessCallback(struct _EPROCESS *Process, ExInitializeFastMutex(&Win32Process->DriverObjListLock); Win32Process->KeyboardLayout = W32kGetDefaultKeyLayout(); + EngCreateEvent((PEVENT *)&Win32Process->InputIdleEvent); + KeInitializeEvent(Win32Process->InputIdleEvent, NotificationEvent, FALSE); if(Process->Peb != NULL) { @@ -118,6 +120,13 @@ Win32kProcessCallback(struct _EPROCESS *Process, else { DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); + Win32Process->W32PF_flags |= W32PF_TERMINATED; + if (Win32Process->InputIdleEvent) + { + EngFreeMem((PVOID)Win32Process->InputIdleEvent); + Win32Process->InputIdleEvent = NULL; + } + IntCleanupMenus(Process, Win32Process); IntCleanupCurIcons(Process, Win32Process); CleanupMonitorImpl(); diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 9dc56fde731..23dbb965b06 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -15,6 +15,8 @@ #define NDEBUG #include +BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process); + #define PM_BADMSGFLAGS ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE) typedef struct @@ -323,6 +325,52 @@ UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL No return STATUS_INVALID_PARAMETER; } +// +// Wakeup any thread/process waiting on idle input. +// +VOID FASTCALL +IdlePing(VOID) +{ + PPROCESSINFO ppi = PsGetCurrentProcessWin32Process(); + PUSER_MESSAGE_QUEUE ForegroundQueue; + PTHREADINFO pti, ptiForeground = NULL; + + ForegroundQueue = IntGetFocusMessageQueue(); + + if (ForegroundQueue) + ptiForeground = ForegroundQueue->Thread->Tcb.Win32Thread; + + pti = PsGetCurrentThreadWin32Thread(); + + if ( pti && pti->pDeskInfo && pti == ptiForeground ) + { + if ( pti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE) || + pti->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE) ) + { + co_HOOK_CallHooks(WH_FOREGROUNDIDLE,HC_ACTION,0,0); + } + } + + DPRINT("IdlePing ppi 0x%x\n",ppi); + if ( ppi && ppi->InputIdleEvent ) + { + DPRINT("InputIdleEvent\n"); + KeSetEvent( ppi->InputIdleEvent, IO_NO_INCREMENT, FALSE); + } +} + +VOID FASTCALL +IdlePong(VOID) +{ + PPROCESSINFO ppi = PsGetCurrentProcessWin32Process(); + + DPRINT("IdlePong ppi 0x%x\n",ppi); + if ( ppi && ppi->InputIdleEvent ) + { + KeClearEvent(ppi->InputIdleEvent); + } +} + static VOID FASTCALL IntCallWndProc( PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { @@ -856,6 +904,8 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, RemoveMessages = RemoveMsg & PM_REMOVE; + IdlePong(); + do { KeQueryTickCount(&LargeTickCount); @@ -944,10 +994,6 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, } while (TRUE); - // The WH_GETMESSAGE hook enables an application to monitor messages about to - // be returned by the GetMessage or PeekMessage function. - - co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE, (LPARAM)&Msg->Msg); return TRUE; } @@ -1068,6 +1114,7 @@ co_IntWaitMessage( PWND Window, { return TRUE; } + /* Nothing found. Wait for new messages. */ Status = co_MsqWaitForNewMessages( ThreadQueue, Window, @@ -1094,9 +1141,9 @@ co_IntGetPeekMessage( PMSG pMsg, UINT RemoveMsg, BOOL bGMSG ) { - BOOL Present; PWND Window; USER_MESSAGE Msg; + BOOL Present = FALSE; if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST ) hWnd = HWND_BOTTOM; @@ -1123,6 +1170,8 @@ co_IntGetPeekMessage( PMSG pMsg, MsgFilterMax = 0; } + RtlZeroMemory(&Msg, sizeof(USER_MESSAGE)); + do { Present = co_IntPeekMessage( &Msg, @@ -1132,33 +1181,40 @@ co_IntGetPeekMessage( PMSG pMsg, RemoveMsg ); if (Present) { - RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG)); + RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG)); - if (bGMSG) - return (WM_QUIT != pMsg->message); - else - return TRUE; + // The WH_GETMESSAGE hook enables an application to monitor messages about to + // be returned by the GetMessage or PeekMessage function. + + co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE, (LPARAM)pMsg); + + if ( bGMSG ) + return (WM_QUIT != pMsg->message); } - if ( bGMSG && !co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax) ) + if ( bGMSG ) { - return -1; + if ( !co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax) ) + return -1; } else { - if (!(RemoveMsg & PM_NOYIELD)) - { - // Yield this thread! - UserLeave(); - ZwYieldExecution(); - UserEnterExclusive(); - // Fall through to fail. - } + if (!(RemoveMsg & PM_NOYIELD)) + { + IdlePing(); + // Yield this thread! + UserLeave(); + ZwYieldExecution(); + UserEnterExclusive(); + // Fall through to exit. + IdlePong(); + } + break; } } while( bGMSG && !Present ); - return FALSE; + return Present; } BOOL FASTCALL @@ -2049,49 +2105,30 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, * retrieved. */ { - BOOL GotMessage; NTUSERGETMESSAGEINFO Info; NTSTATUS Status; /* FIXME: if initialization is removed, gcc complains that this may be used before initialization. Please review */ - PWND Window = NULL; PMSGMEMORY MsgMemoryEntry; PVOID UserMem; ULONG Size; - USER_MESSAGE Msg; + MSG Msg; + BOOL GotMessage; + + if ( (MsgFilterMin|MsgFilterMax) & ~WM_MAXIMUM ) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } - DPRINT("Enter NtUserGetMessage\n"); UserEnterExclusive(); - /* Validate input */ - if (hWnd && !(Window = UserGetWindowObject(hWnd))) - { - UserLeave(); - return -1; - } + RtlZeroMemory(&Msg, sizeof(MSG)); - // if (Window) UserRefObjectCo(Window, &Ref); - - if (MsgFilterMax < MsgFilterMin) - { - MsgFilterMin = 0; - MsgFilterMax = 0; - } - - do - { - GotMessage = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, PM_REMOVE); - - if (!GotMessage && !co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax)) - { - UserLeave(); - return -1; - } - } - while (! GotMessage); + GotMessage = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE); UserLeave(); - Info.Msg = Msg.Msg; + Info.Msg = Msg; //.Msg; /* See if this message type is present in the table */ MsgMemoryEntry = FindMsgMemory(Info.Msg.message); @@ -2103,7 +2140,7 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, if (NULL == MsgMemoryEntry) { /* Not present, no copying needed */ - Info.LParamSize = 0; + UnsafeInfo->LParamSize = 0; } else { @@ -2127,8 +2164,8 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, ProbeForWrite(UserMem, Size, 1); RtlCopyMemory(UserMem, (PVOID)Info.Msg.lParam, Size); - Info.LParamSize = Size; - Info.Msg.lParam = (LPARAM) UserMem; + UnsafeInfo->LParamSize = Size; + UnsafeInfo->Msg.lParam = (LPARAM) UserMem; } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -2144,7 +2181,7 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, } _SEH2_END; - return (Info.Msg.message != WM_QUIT ); + return GotMessage; } @@ -2163,10 +2200,10 @@ NtUserGetMessageX(PMSG pMsg, return FALSE; } - RtlZeroMemory(&Msg, sizeof(MSG)); - UserEnterExclusive(); + RtlZeroMemory(&Msg, sizeof(MSG)); + Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE); UserLeave(); @@ -2197,46 +2234,30 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, UINT RemoveMsg) { NTSTATUS Status; - BOOL Ret; NTUSERGETMESSAGEINFO Info; - PWND Window; PMSGMEMORY MsgMemoryEntry; PVOID UserMem = NULL; ULONG Size; - USER_MESSAGE Msg; + MSG Msg; + BOOL Ret; + + if ( RemoveMsg & PM_BADMSGFLAGS ) + { + SetLastWin32Error(ERROR_INVALID_FLAGS); + return FALSE; + } UserEnterExclusive(); - if (hWnd == (HWND)-1 || hWnd == (HWND)0x0000FFFF || hWnd == (HWND)0xFFFFFFFF) - hWnd = (HWND)1; + RtlZeroMemory(&Msg, sizeof(MSG)); - /* Validate input */ - if (hWnd && hWnd != (HWND)1) - { - if (!(Window = UserGetWindowObject(hWnd))) - { - UserLeave(); - return -1; - } - } - else - { - Window = (PWND)hWnd; - } - - if (MsgFilterMax < MsgFilterMin) - { - MsgFilterMin = 0; - MsgFilterMax = 0; - } - - Ret = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, RemoveMsg); + Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE); UserLeave(); if (Ret) { - Info.Msg = Msg.Msg; + Info.Msg = Msg; /* See if this message type is present in the table */ MsgMemoryEntry = FindMsgMemory(Info.Msg.message); @@ -2248,7 +2269,7 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, if (NULL == MsgMemoryEntry) { /* Not present, no copying needed */ - Info.LParamSize = 0; + UnsafeInfo->LParamSize = 0; } else { @@ -2272,8 +2293,8 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo, ProbeForWrite(UserMem, Size, 1); RtlCopyMemory(UserMem, (PVOID)Info.Msg.lParam, Size); - Info.LParamSize = Size; - Info.Msg.lParam = (LPARAM) UserMem; + UnsafeInfo->LParamSize = Size; + UnsafeInfo->Msg.lParam = (LPARAM) UserMem; } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -2308,10 +2329,10 @@ NtUserPeekMessageX( PMSG pMsg, return FALSE; } - RtlZeroMemory(&Msg, sizeof(MSG)); - UserEnterExclusive(); + RtlZeroMemory(&Msg, sizeof(MSG)); + Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE); UserLeave(); @@ -2665,10 +2686,10 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, { PEPROCESS Process; PPROCESSINFO W32Process; + PTHREADINFO pti; NTSTATUS Status; - HANDLE Handles[2]; + HANDLE Handles[3]; LARGE_INTEGER Timeout; - ULONGLONG StartTime, Run, Elapsed = 0; UserEnterExclusive(); @@ -2686,8 +2707,13 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, return WAIT_FAILED; } + pti = PsGetCurrentThreadWin32Thread(); + W32Process = (PPROCESSINFO)Process->Win32Process; - if (!W32Process) + + if ( PsGetProcessExitProcessCalled(Process) || + !W32Process || + pti->ppi == W32Process) { ObDereferenceObject(Process); UserLeave(); @@ -2695,10 +2721,9 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, return WAIT_FAILED; } - EngCreateEvent((PEVENT *)&W32Process->InputIdleEvent); - Handles[0] = Process; Handles[1] = W32Process->InputIdleEvent; + Handles[2] = pti->MessageQueue->NewMessages; // pEventQueueServer; IntMsqSetWakeMask returns hEventQueueClient if (!Handles[1]) { @@ -2707,16 +2732,15 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, return STATUS_SUCCESS; /* no event to wait on */ } - StartTime = EngGetTickCount(); - - Run = dwMilliseconds; + if (dwMilliseconds != INFINITE) + Timeout.QuadPart = (LONGLONG) dwMilliseconds * (LONGLONG) -10000; + DPRINT("WFII: ppi 0x%x\n",W32Process); DPRINT("WFII: waiting for %p\n", Handles[1] ); do { - Timeout.QuadPart = Run - Elapsed; UserLeave(); - Status = KeWaitForMultipleObjects( 2, + Status = KeWaitForMultipleObjects( 3, Handles, WaitAny, UserRequest, @@ -2736,21 +2760,19 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, switch (Status) { case STATUS_WAIT_0: - Status = WAIT_FAILED; goto WaitExit; case STATUS_WAIT_2: { - USER_MESSAGE Msg; - co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE ); - break; + USER_MESSAGE Msg; + co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE ); + DPRINT1("WFII: WAIT 2\n"); } + break; - case STATUS_USER_APC: - case STATUS_ALERTED: case STATUS_TIMEOUT: DPRINT1("WFII: timeout\n"); - Status = STATUS_TIMEOUT; + case WAIT_FAILED: goto WaitExit; default: @@ -2758,24 +2780,10 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, Status = STATUS_SUCCESS; goto WaitExit; } - - if (dwMilliseconds != INFINITE) - { - Elapsed = EngGetTickCount() - StartTime; - - if (Elapsed > Run) - Status = STATUS_TIMEOUT; - break; - } } - while (1); + while (TRUE); WaitExit: - if (W32Process->InputIdleEvent) - { - EngFreeMem((PVOID)W32Process->InputIdleEvent); - W32Process->InputIdleEvent = NULL; - } ObDereferenceObject(Process); UserLeave(); return Status; diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index e3c7361b696..f451a865e54 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -62,32 +62,6 @@ static PAGED_LOOKASIDE_LIST MessageLookasideList; /* FUNCTIONS *****************************************************************/ -// -// Wakeup any thread/process waiting on idle input. -// -static VOID FASTCALL -IdlePing(VOID) -{ - HWND hWnd; - PWND Window; - PPROCESSINFO W32d = PsGetCurrentProcessWin32Process(); - - hWnd = UserGetForegroundWindow(); - - Window = UserGetWindowObject(hWnd); - - if (Window && Window->head.pti) - { - if (Window->head.pti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE)) - { - co_HOOK_CallHooks(WH_FOREGROUNDIDLE,HC_ACTION,0,0); - } - } - - if (W32d && W32d->InputIdleEvent) - KePulseEvent( W32d->InputIdleEvent, EVENT_INCREMENT, TRUE); -} - HANDLE FASTCALL IntMsqSetWakeMask(DWORD WakeMask) { @@ -578,8 +552,6 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, WaitObjects[0] = &HardwareMessageQueueLock; do { - IdlePing(); - UserLeaveCo(); WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest, @@ -1185,8 +1157,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue, if(Block) { - IdlePing(); - UserLeaveCo(); /* don't process messages sent to the thread */ @@ -1248,8 +1218,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue, WaitObjects[1] = ThreadQueue->NewMessages; do { - IdlePing(); - UserLeaveCo(); WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest, @@ -1407,8 +1375,6 @@ co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWND WndFilter, PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent}; NTSTATUS ret; - IdlePing(); // Going to wait so send Idle ping. - UserLeaveCo(); ret = KeWaitForMultipleObjects(2, From 4ac999a033c18b237eb781762d1c14fc13b33460 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 14 Nov 2010 09:01:17 +0000 Subject: [PATCH 019/132] [win32k] - Simplify co_IntPeekMessage even more svn path=/trunk/; revision=49580 --- .../win32/win32k/include/msgqueue.h | 2 +- .../subsystems/win32/win32k/include/win32kp.h | 4 ++ .../subsystems/win32/win32k/ntuser/message.c | 46 ++++++------------- .../subsystems/win32/win32k/ntuser/msgqueue.c | 27 ++++++++--- 4 files changed, 40 insertions(+), 39 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index e1c2972622e..f36d3f4b0d7 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -127,7 +127,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, - OUT PUSER_MESSAGE* Message); + OUT PMSG Message); BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue); VOID FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/win32kp.h b/reactos/subsystems/win32/win32k/include/win32kp.h index 1dc0073bb0f..b84a319947f 100644 --- a/reactos/subsystems/win32/win32k/include/win32kp.h +++ b/reactos/subsystems/win32/win32k/include/win32kp.h @@ -11,8 +11,12 @@ #pragma once #define INTERNAL_CALL APIENTRY +#ifndef _MSC_VER #define PLACE_IN_SECTION(s) __attribute__((section(s))) #define INIT_FUNCTION PLACE_IN_SECTION("INIT") +#else +#define INIT_FUNCTION +#endif /* Internal Win32k Headers */ #include diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 23dbb965b06..4fbdb42f4e9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -887,7 +887,7 @@ BOOL ProcessHardwareMessage(MSG* Msg, BOOLEAN RemoveMessages) * Internal version of PeekMessage() doing all the work */ BOOL FASTCALL -co_IntPeekMessage( PUSER_MESSAGE Msg, +co_IntPeekMessage( PMSG Msg, PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, @@ -896,7 +896,6 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, PTHREADINFO pti; LARGE_INTEGER LargeTickCount; PUSER_MESSAGE_QUEUE ThreadQueue; - PUSER_MESSAGE Message; BOOL RemoveMessages; pti = PsGetCurrentThreadWin32Thread(); @@ -920,10 +919,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, { /* According to the PSDK, WM_QUIT messages are always returned, regardless of the filter specified */ - Msg->Msg.hwnd = NULL; - Msg->Msg.message = WM_QUIT; - Msg->Msg.wParam = ThreadQueue->QuitExitCode; - Msg->Msg.lParam = 0; + Msg->hwnd = NULL; + Msg->message = WM_QUIT; + Msg->wParam = ThreadQueue->QuitExitCode; + Msg->lParam = 0; if (RemoveMessages) { ThreadQueue->QuitPosted = FALSE; @@ -939,14 +938,9 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, Window, MsgFilterMin, MsgFilterMax, - &Message )) + Msg )) { - RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE)); - if (RemoveMessages) - { - MsqDestroyMessage(Message); - } - break; + return TRUE; } /* Check for hardware events. */ @@ -956,18 +950,13 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, Window, MsgFilterMin, MsgFilterMax, - &Message )) + Msg )) { - RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE)); - if (RemoveMessages) - { - MsqDestroyMessage(Message); - } - if(!ProcessHardwareMessage(&Msg->Msg, RemoveMessages)) + if(!ProcessHardwareMessage(Msg, RemoveMessages)) continue; - break; + return TRUE; } /* Check for sent messages again. */ @@ -979,10 +968,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg, MsgFilterMin, MsgFilterMax, pti, - &Msg->Msg, + Msg, RemoveMessages)) { - break; + return TRUE; } if (PostTimerMessages(Window)) @@ -1099,7 +1088,7 @@ co_IntWaitMessage( PWND Window, PTHREADINFO pti; PUSER_MESSAGE_QUEUE ThreadQueue; NTSTATUS Status = STATUS_SUCCESS; - USER_MESSAGE Msg; + MSG Msg; pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; @@ -1142,7 +1131,6 @@ co_IntGetPeekMessage( PMSG pMsg, BOOL bGMSG ) { PWND Window; - USER_MESSAGE Msg; BOOL Present = FALSE; if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST ) @@ -1170,19 +1158,15 @@ co_IntGetPeekMessage( PMSG pMsg, MsgFilterMax = 0; } - RtlZeroMemory(&Msg, sizeof(USER_MESSAGE)); - do { - Present = co_IntPeekMessage( &Msg, + Present = co_IntPeekMessage( pMsg, Window, MsgFilterMin, MsgFilterMax, RemoveMsg ); if (Present) { - RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG)); - // The WH_GETMESSAGE hook enables an application to monitor messages about to // be returned by the GetMessage or PeekMessage function. @@ -2764,7 +2748,7 @@ NtUserWaitForInputIdle( IN HANDLE hProcess, case STATUS_WAIT_2: { - USER_MESSAGE Msg; + MSG Msg; co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE ); DPRINT1("WFII: WAIT 2\n"); } diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index f451a865e54..320560b6d44 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -535,7 +535,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT BOOL APIENTRY co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT FilterLow, UINT FilterHigh, BOOL Remove, - PUSER_MESSAGE* Message) + PMSG Message) { KIRQL OldIrql; POINT ScreenPoint; @@ -587,14 +587,15 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry); if (Accept) { + *Message = Current->Msg; if (Remove) { RemoveEntryList(&Current->ListEntry); + MsqDestroyMessage(Current); } IntUnLockHardwareMessageQueue(MessageQueue); IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current; - + if (Desk) Desk->LastInputWasKbd = FALSE; @@ -604,13 +605,14 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, } else { + *Message = Current->Msg; if (Remove) { RemoveEntryList(&Current->ListEntry); + MsqDestroyMessage(Current); } IntUnLockHardwareMessageQueue(MessageQueue); IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current; RETURN(TRUE); } @@ -693,7 +695,12 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, IntUnLockHardwareMessageQueue(MessageQueue); } IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current; + *Message = Current->Msg; + + if (Remove) + { + MsqDestroyMessage(Current); + } RETURN(TRUE); } @@ -1325,7 +1332,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, - OUT PUSER_MESSAGE* Message) + OUT PMSG Message) { PLIST_ENTRY CurrentEntry; PUSER_MESSAGE CurrentMessage; @@ -1359,7 +1366,13 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, RemoveEntryList(&CurrentMessage->ListEntry); } - *Message = CurrentMessage; + *Message= CurrentMessage->Msg; + + if (Remove) + { + MsqDestroyMessage(CurrentMessage); + } + return(TRUE); } CurrentEntry = CurrentEntry->Flink; From 6fce3aa19b99274dd3db32e1f18ccf3dafcc0d9e Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 14 Nov 2010 09:53:07 +0000 Subject: [PATCH 020/132] [win32k] -Rename MsqInsertSystemMessage to MsqInsertMouseMessage svn path=/trunk/; revision=49581 --- .../win32/win32k/include/msgqueue.h | 2 +- .../win32/win32k/ntuser/cursoricon.c | 2 +- .../subsystems/win32/win32k/ntuser/input.c | 22 +++++++++---------- .../subsystems/win32/win32k/ntuser/msgqueue.c | 2 +- .../subsystems/win32/win32k/ntuser/window.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index f36d3f4b0d7..0c6cc8b7240 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -196,7 +196,7 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); VOID FASTCALL MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam); VOID FASTCALL -MsqInsertSystemMessage(MSG* Msg); +MsqInsertMouseMessage(MSG* Msg); BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove); BOOL FASTCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 2d8ff953a06..37af3f00690 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -217,7 +217,7 @@ BOOL UserSetCursorPos( INT x, INT y, BOOL SendMouseMoveMsg) Msg.wParam = CurInfo->ButtonsDown; Msg.lParam = MAKELPARAM(x, y); Msg.pt = pt; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } /* Store the new cursor position */ diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 4014e4edee9..e47339cad3a 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1156,7 +1156,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[0][SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_LEFTUP) { @@ -1164,7 +1164,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[1][SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) { @@ -1172,7 +1172,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = WM_MBUTTONDOWN; CurInfo->ButtonsDown |= MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP) { @@ -1180,7 +1180,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = WM_MBUTTONUP; CurInfo->ButtonsDown &= ~MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) { @@ -1188,7 +1188,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[0][!SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP) { @@ -1196,7 +1196,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[1][!SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) && @@ -1214,14 +1214,14 @@ IntMouseInput(MOUSEINPUT *mi) gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } } else if(mi->dwFlags & MOUSEEVENTF_XUP) @@ -1232,21 +1232,21 @@ IntMouseInput(MOUSEINPUT *mi) gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } } if(mi->dwFlags & MOUSEEVENTF_WHEEL) { Msg.message = WM_MOUSEWHEEL; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData); - MsqInsertSystemMessage(&Msg); + MsqInsertMouseMessage(&Msg); } return TRUE; diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 320560b6d44..77d809658d7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -137,7 +137,7 @@ MsqInitializeImpl(VOID) } VOID FASTCALL -MsqInsertSystemMessage(MSG* Msg) +MsqInsertMouseMessage(MSG* Msg) { LARGE_INTEGER LargeTickCount; KIRQL OldIrql; diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 4233818e00d..dd714cd9483 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -2569,7 +2569,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window) msg.wParam = IntGetSysCursorInfo()->ButtonsDown; msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y); msg.pt = gpsi->ptCursor; - MsqInsertSystemMessage(&msg); + MsqInsertMouseMessage(&msg); if (!IntIsWindow(Window->head.h)) { From 14a5ef32d6f463b956e9f25ce31b282ae2e1be67 Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sun, 14 Nov 2010 15:22:48 +0000 Subject: [PATCH 021/132] Bug 5726: PATCH: regedit: Language File skeleton strings (geekdundeegmail.com) Bug 5735: PATCH: updated slovak translations by Mario Kacmar Bug 5740: TRANSLATION: rapps: polish (wojtekkozlo664op.pl) Updated the Rapps Versions, too. svn path=/trunk/; revision=49587 --- reactos/base/applications/calc/lang/sk-SK.rc | 16 ++--- .../base/applications/rapps/rapps/7zip.txt | 3 + .../base/applications/rapps/rapps/abyss.txt | 5 ++ .../applications/rapps/rapps/comctl32ocx.txt | 2 +- .../applications/rapps/rapps/dosblaster.txt | 3 + reactos/base/applications/rapps/rapps/fap.txt | 3 + .../applications/rapps/rapps/firefox36.txt | 16 ++--- .../base/applications/rapps/rapps/go-oo.txt | 2 +- .../base/applications/rapps/rapps/kdewin.txt | 3 + .../applications/rapps/rapps/mirandaim.txt | 4 +- .../base/applications/rapps/rapps/mirc.txt | 4 +- .../base/applications/rapps/rapps/mono2.txt | 9 ++- reactos/base/applications/rapps/rapps/mpc.txt | 3 + .../base/applications/rapps/rapps/net11.txt | 3 + .../base/applications/rapps/rapps/net20.txt | 3 + .../applications/rapps/rapps/net20sp2.txt | 3 + .../base/applications/rapps/rapps/python.txt | 4 ++ .../base/applications/rapps/rapps/remood.txt | 3 + .../base/applications/rapps/rapps/scite.txt | 7 +- .../applications/rapps/rapps/seamonkey.txt | 12 ++-- .../base/applications/rapps/rapps/steam.txt | 3 + .../applications/rapps/rapps/superfinder.txt | 3 + .../base/applications/rapps/rapps/tahoma.txt | 3 + .../applications/rapps/rapps/thunderbird.txt | 14 ++-- .../applications/rapps/rapps/ultravnc.txt | 9 ++- .../applications/rapps/rapps/utorrent.txt | 6 +- reactos/base/applications/rapps/rapps/vlc.txt | 9 ++- .../base/applications/regedit/lang/bg-BG.rc | 16 +++++ .../base/applications/regedit/lang/cs-CZ.rc | 16 +++++ .../base/applications/regedit/lang/de-DE.rc | 16 +++++ .../base/applications/regedit/lang/el-GR.rc | 16 +++++ .../base/applications/regedit/lang/es-ES.rc | 16 +++++ .../base/applications/regedit/lang/fr-FR.rc | 16 +++++ .../base/applications/regedit/lang/hu-HU.rc | 16 +++++ .../base/applications/regedit/lang/id-ID.rc | 16 +++++ .../base/applications/regedit/lang/it-IT.rc | 16 +++++ .../base/applications/regedit/lang/ja-JP.rc | 16 +++++ .../base/applications/regedit/lang/ko-KR.rc | 16 +++++ .../base/applications/regedit/lang/nl-NL.rc | 16 +++++ .../base/applications/regedit/lang/no-NO.rc | 16 +++++ .../base/applications/regedit/lang/pl-PL.rc | 16 +++++ .../base/applications/regedit/lang/pt-BR.rc | 16 +++++ .../base/applications/regedit/lang/pt-PT.rc | 16 +++++ .../base/applications/regedit/lang/ru-RU.rc | 14 ++++ .../base/applications/regedit/lang/sk-SK.rc | 16 +++++ .../base/applications/regedit/lang/sl-SI.rc | 16 +++++ .../base/applications/regedit/lang/sv-SE.rc | 16 +++++ .../base/applications/regedit/lang/th-TH.rc | 16 +++++ .../base/applications/regedit/lang/uk-UA.rc | 16 +++++ .../base/applications/regedit/lang/zh-CN.rc | 16 +++++ reactos/base/setup/usetup/lang/sk-SK.h | 6 +- reactos/base/shell/cmd/lang/sk-SK.rc | 68 +++++++++---------- reactos/base/system/format/lang/sk-SK.rc | 30 ++++---- 53 files changed, 524 insertions(+), 101 deletions(-) diff --git a/reactos/base/applications/calc/lang/sk-SK.rc b/reactos/base/applications/calc/lang/sk-SK.rc index 2bf46e61535..41f9ca78fe2 100644 --- a/reactos/base/applications/calc/lang/sk-SK.rc +++ b/reactos/base/applications/calc/lang/sk-SK.rc @@ -1,6 +1,6 @@ /* TRANSLATOR : Mário Kaèmár /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR.: 30-01-2008 - * LAST CHANGE: 31-05-2010 + * LAST CHANGE: 17-09-2010 * --------------------------------------- * TODO: * pridanie navigaèných znaèiek "&" ? @@ -545,9 +545,9 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_ENERGY_15_C_CALORIES "15 °C calories" - IDS_ENERGY_BTUS "British Thermal Units" + IDS_ENERGY_BTUS "Britské termálne jednotky" IDS_ENERGY_ERGS "Ergs" - IDS_ENERGY_EVS "Electron-Volts" + IDS_ENERGY_EVS "Elektron-Volty" IDS_ENERGY_FOOT_POUNDS "Foot-Pounds" IDS_ENERGY_IT_CALORIES "International Table calories" IDS_ENERGY_IT_KILOCALORIES "International Table kilocalories" @@ -593,7 +593,7 @@ BEGIN IDS_LENGTH_MILLIMETERS "Milimetre" IDS_LENGTH_NAUTICAL_MILES "Námorné míle" IDS_LENGTH_NIEU "Nieu" - IDS_LENGTH_PARSECS "Parsecy" + IDS_LENGTH_PARSECS "Parseky" IDS_LENGTH_PICAS "Picas" IDS_LENGTH_RI_JAPAN "Ri (Japonsko)" IDS_LENGTH_RI_KOREA "Ri (Kórea)" @@ -626,10 +626,10 @@ STRINGTABLE DISCARDABLE BEGIN IDS_PRESSURE_ATMOSPHERES "Atmosféry" IDS_PRESSURE_BARS "Bary" - IDS_PRESSURE_HECTOPASCALS "Hektopascals" - IDS_PRESSURE_KILOPASCALS "Kilopascals" - IDS_PRESSURE_MM_OF_MERCURY "Millimeters of mercury" - IDS_PRESSURE_PASCALS "Pascals" + IDS_PRESSURE_HECTOPASCALS "Hektopascaly" + IDS_PRESSURE_KILOPASCALS "Kilopascaly" + IDS_PRESSURE_MM_OF_MERCURY "Milimetre ortuti" + IDS_PRESSURE_PASCALS "Pascaly" IDS_PRESSURE_PSI "Libry na štvorcový palec" END diff --git a/reactos/base/applications/rapps/rapps/7zip.txt b/reactos/base/applications/rapps/rapps/7zip.txt index 93cdb8ad47e..fb070f717d4 100644 --- a/reactos/base/applications/rapps/rapps/7zip.txt +++ b/reactos/base/applications/rapps/rapps/7zip.txt @@ -17,5 +17,8 @@ Description = Tool zum Erstellen und Öffnen von 7zip, zip, tar, rar und andrern [Section.040a] Description = Utilidad para crear y abrir 7zip, zip, tar, rar y otros archivos comprimidos. +[Section.0415] +Description = NarzÄ™dzie do tworzenia i otwierania plików typu 7zip, zip, tar, i innych plików archiwizacyjnych. + [Section.0422] Description = Утиліта Ð´Ð»Ñ ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ñ‚Ð° Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ñ‚Ñ 7zip, zip, tar, rar та інших архівних файлів. diff --git a/reactos/base/applications/rapps/rapps/abyss.txt b/reactos/base/applications/rapps/rapps/abyss.txt index 49d505cf414..8959327b617 100644 --- a/reactos/base/applications/rapps/rapps/abyss.txt +++ b/reactos/base/applications/rapps/rapps/abyss.txt @@ -14,5 +14,10 @@ CDPath = none [Section.0407] Description = Abyss Web Server ermöglicht es Webseiten auf Ihrem Computer zu hosten. Er unterstützt sichere SSL/TLS Verbindungen (HTTPS) sowie eine Vielfalt an Web Technologien. Er kann ebenfalls PHP, Perl, Python, ASP, ASP.NET, und Ruby on Rails Web Anwendungen ausführen, welche von Datenbanken, wie MySQL, SQLite, MS SQL Server, MS Access, oder Oracle unterstützt werden können. +[Section.0415] +Description = Abyss Web Server pozwala Ci na stworzenie serwera WWW na wÅ‚asnym komputerze. Ten program obsÅ‚uguje zabezpieczone połączenia typu SSL/TLS (HTTPS) i wiele technologii Sieci. +Może także uruchamiać zaawansowane aplikacje internetowe takie jak PHP, Perl, Python, ASP, ASP.NET, i Ruby on Rails. +MogÄ… one zostać oparte o MySQL, SQLite, MS SQL Server, MS Access, lub Oracle. + [Section.0422] Description = Abyss Web Server дозволить вам утримувати веб-Ñайти на вашому комп'ютері. Від підтримує безпечні SSL/TLS з'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ (HTTPS) та великий Ñ€Ñд веб-технологій. Він також запуÑкає PHP, Perl, Python, ASP, ASP.NET, та Ruby on Rails веб-додатки, Ñкі можуть підтримуватиÑÑŒ такими базами даних, Ñк MySQL, SQLite, MS SQL Server, MS Access, чи Oracle. diff --git a/reactos/base/applications/rapps/rapps/comctl32ocx.txt b/reactos/base/applications/rapps/rapps/comctl32ocx.txt index a678a338180..392e8faf26c 100644 --- a/reactos/base/applications/rapps/rapps/comctl32ocx.txt +++ b/reactos/base/applications/rapps/rapps/comctl32ocx.txt @@ -21,7 +21,7 @@ Description = X es necesario para varias aplicaciones. [Section.0415] Licence = Nieznana -Description = X jest używana przez część aplikacji. +Description = Microsoft Visual Basic 6.0 Common Controls jest używany przez część aplikacji. [Section.0422] Licence = Ðевідома diff --git a/reactos/base/applications/rapps/rapps/dosblaster.txt b/reactos/base/applications/rapps/rapps/dosblaster.txt index 3974dda66aa..a499b7a956c 100644 --- a/reactos/base/applications/rapps/rapps/dosblaster.txt +++ b/reactos/base/applications/rapps/rapps/dosblaster.txt @@ -17,5 +17,8 @@ Description = DosBlaster ist eine Shell Extension, die es ermöglicht jede DOS A [Section.040a] Description = DosBlaster en una extensión Shell que permite abrir cualquier ejecutable DOS en DOSBox desde el botón derecho del ratón. Esta versión contiene DOSBox 0.70, pero puede ser actualizado facilmente instalando una nueva versión de DOSBox en la carpeta de DosBlaster. +[Section.0415] +Description = DosBlaster to rozszerzenie powÅ‚oki, które umożliwia otwarcie każdego DOS-owego pliku wykonywalnego w DOSBox za pomocÄ… prawego klawisza myszki. Ta wersja zawiera DosBox 0.70, ale można go Å‚atwo zaktualizować, instalujÄ…c nowszÄ… wersje DOSBox do folderów DosBlaster. + [Section.0422] Description = DosBlaster це Ñ€Ð¾Ð·ÑˆÐ¸Ñ€ÐµÐ½Ð½Ñ Ð¾Ð±Ð¾Ð»Ð¾Ð½ÐºÐ¸, Ñке дозволÑÑ” запуÑтити будь-Ñкий виконавчий файл DOS в DOSBox через правий клік. Ð¦Ñ Ð²ÐµÑ€ÑÑ–Ñ Ð¼Ñ–Ñтить DOSBox 0.70, але може бути оновлена вÑтановленнÑм новішої верÑÑ–Ñ— DOSBox в теки DosBlaster. diff --git a/reactos/base/applications/rapps/rapps/fap.txt b/reactos/base/applications/rapps/rapps/fap.txt index 6bbac0edc57..56a42cb23f8 100644 --- a/reactos/base/applications/rapps/rapps/fap.txt +++ b/reactos/base/applications/rapps/rapps/fap.txt @@ -14,5 +14,8 @@ CDPath = none [Section.0407] Description = Kleiner und einfacher Mediaplayer. +[Section.0415] +Description = Prosty i lekki odtwarzacz audio. + [Section.0422] Description = ПроÑтий та маленький програвач аудіо файлів. diff --git a/reactos/base/applications/rapps/rapps/firefox36.txt b/reactos/base/applications/rapps/rapps/firefox36.txt index 92b7a75b809..31b72a5514f 100644 --- a/reactos/base/applications/rapps/rapps/firefox36.txt +++ b/reactos/base/applications/rapps/rapps/firefox36.txt @@ -2,47 +2,47 @@ [Section] Name = Mozilla Firefox 3.6 -Version = 3.6.11 +Version = 3.6.12 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Web Browsers out there. Size = 8.1M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/en-US/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/en-US/Firefox%20Setup%203.6.12.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. Size = 8.0M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/de/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/de/Firefox%20Setup%203.6.12.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. Size = 8.0M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/es-ES/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/es-ES/Firefox%20Setup%203.6.12.exe [Section.0414] Description = Mest populære og best ogsÃ¥ gratis nettleserene der ute. Size = 8.0M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/nb-NO/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/nb-NO/Firefox%20Setup%203.6.12.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglÄ…darek internetowych. Size = 8.8M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/pl/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/pl/Firefox%20Setup%203.6.12.exe [Section.0419] Description = Один из Ñамых популÑрных и лучших беÑплатных браузеров. Size = 8.4M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/ru/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/ru/Firefox%20Setup%203.6.12.exe [Section.0422] Description = ÐайпопулÑрніший та один з кращих безплатних веб-браузерів. Size = 8.4M URLSite = http://www.mozilla-europe.org/uk/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/uk/Firefox%20Setup%203.6.11.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.12/win32/uk/Firefox%20Setup%203.6.12.exe diff --git a/reactos/base/applications/rapps/rapps/go-oo.txt b/reactos/base/applications/rapps/rapps/go-oo.txt index e32599ed605..39dbe608ad5 100644 --- a/reactos/base/applications/rapps/rapps/go-oo.txt +++ b/reactos/base/applications/rapps/rapps/go-oo.txt @@ -18,7 +18,7 @@ Description = Open Source Office Suite, basierend auf Open Office, aber viel bes Description = La suite de ofimática de código abierto. [Section.0415] -Description = Otwarty pakiet biurowy. +Description = Otwarty pakiet biurowy, bazujÄ…cy na Open Office, ale znacznie lepszy. [Section.0422] Description = Відкритий офіÑний пакет. diff --git a/reactos/base/applications/rapps/rapps/kdewin.txt b/reactos/base/applications/rapps/rapps/kdewin.txt index f0bd4ecd08c..4c47525940a 100644 --- a/reactos/base/applications/rapps/rapps/kdewin.txt +++ b/reactos/base/applications/rapps/rapps/kdewin.txt @@ -14,5 +14,8 @@ CDPath = none [Section.0407] Description = KDE für Windows. +[Section.0415] +Description = KDE dla Windows. + [Section.0422] Description = KDE Ð´Ð»Ñ Windows. diff --git a/reactos/base/applications/rapps/rapps/mirandaim.txt b/reactos/base/applications/rapps/rapps/mirandaim.txt index 8cc6b8ee29e..00737374627 100644 --- a/reactos/base/applications/rapps/rapps/mirandaim.txt +++ b/reactos/base/applications/rapps/rapps/mirandaim.txt @@ -2,13 +2,13 @@ [Section] Name = Miranda IM -Version = 0.9.8 +Version = 0.9.10 Licence = GPL Description = Open source multiprotocol instant messaging application - May not work completely. Size = 3.0MB Category = 5 URLSite = http://www.miranda-im.org/ -URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.8-unicode.exe +URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.10-unicode.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/mirc.txt b/reactos/base/applications/rapps/rapps/mirc.txt index 83a74f3b307..1f7220a9947 100644 --- a/reactos/base/applications/rapps/rapps/mirc.txt +++ b/reactos/base/applications/rapps/rapps/mirc.txt @@ -2,13 +2,13 @@ [Section] Name = mIRC -Version = 7.14 +Version = 7.15 Licence = Shareware Description = The most popular client for the Internet Relay Chat (IRC). Size = 2.0M Category = 5 URLSite = http://www.mirc.com/ -URLDownload = http://download.mirc.com/mirc714.exe +URLDownload = http://download.mirc.com/mirc715.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/mono2.txt b/reactos/base/applications/rapps/rapps/mono2.txt index 6de2539031c..c766941d5f9 100644 --- a/reactos/base/applications/rapps/rapps/mono2.txt +++ b/reactos/base/applications/rapps/rapps/mono2.txt @@ -2,14 +2,17 @@ [Section] Name = Mono .net Development Framework -Version = 2.6.7 +Version = 2.8 Licence = Unknown Description = Open Source .net Framework. -Size = 72MB +Size = 78MB Category = 14 URLSite = http://www.mono-project.com/Main_Page -URLDownload = http://ftp.novell.com/pub/mono/archive/2.6.7/windows-installer/2/mono-2.6.7-gtksharp-2.12.10-win32-2.exe +URLDownload = http://ftp.novell.com/pub/mono/archive/2.8/windows-installer/9/mono-2.8-gtksharp-2.12.10-win32-9.exe CDPath = none +[Section.0415] +Description = Pakiet Mono .net Framework dla Programistów. + [Section.0422] Description = Відкритий .net Фреймворк. diff --git a/reactos/base/applications/rapps/rapps/mpc.txt b/reactos/base/applications/rapps/rapps/mpc.txt index cf59628dcc3..d89fb38bb6a 100644 --- a/reactos/base/applications/rapps/rapps/mpc.txt +++ b/reactos/base/applications/rapps/rapps/mpc.txt @@ -20,5 +20,8 @@ Description = Reproductor multimedia. [Section.0419] Description = Мультимедийный проигрыватель. +[Section.0415] +Description = Odtwarzacz multimediów. + [Section.0422] Description = Мультимедійний програвач. diff --git a/reactos/base/applications/rapps/rapps/net11.txt b/reactos/base/applications/rapps/rapps/net11.txt index f6d4ca63f27..15966d9b229 100644 --- a/reactos/base/applications/rapps/rapps/net11.txt +++ b/reactos/base/applications/rapps/rapps/net11.txt @@ -10,3 +10,6 @@ Category = 14 URLSite = http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3 URLDownload = http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe CDPath = none + +[Section.0415] +Description = Microsoft .NET Framework Wersja 1.1 - Pakiet Dystrybucyjny. diff --git a/reactos/base/applications/rapps/rapps/net20.txt b/reactos/base/applications/rapps/rapps/net20.txt index cb83683985c..a29ed102861 100644 --- a/reactos/base/applications/rapps/rapps/net20.txt +++ b/reactos/base/applications/rapps/rapps/net20.txt @@ -10,3 +10,6 @@ Category = 14 URLSite = http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5 URLDownload = http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe CDPath = none + +[Section.0415] +Description = Microsoft .NET Framework Wersja 2.0 - Pakiet Dystrybucyjny. diff --git a/reactos/base/applications/rapps/rapps/net20sp2.txt b/reactos/base/applications/rapps/rapps/net20sp2.txt index 65c98858d43..1901bfe937e 100644 --- a/reactos/base/applications/rapps/rapps/net20sp2.txt +++ b/reactos/base/applications/rapps/rapps/net20sp2.txt @@ -10,3 +10,6 @@ Category = 14 URLSite = http://www.microsoft.com/downloads/details.aspx?familyid=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F URLDownload = http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_x86.exe CDPath = none + +[Section.0415] +Description = Microsoft .NET Framework Wersja 2.0 Service Pack 2. \ No newline at end of file diff --git a/reactos/base/applications/rapps/rapps/python.txt b/reactos/base/applications/rapps/rapps/python.txt index 4664d47b104..4c77199eb62 100644 --- a/reactos/base/applications/rapps/rapps/python.txt +++ b/reactos/base/applications/rapps/rapps/python.txt @@ -14,5 +14,9 @@ CDPath = none [Section.0407] Description = Eine sehr mächtige, dynamische Programmiersprache. + +[Section.0415] +Description = Potęży i dynamiczny jÄ™zyk programowania. + [Section.0422] Description = Дуже потужна динамічна мова програмуваннÑ. diff --git a/reactos/base/applications/rapps/rapps/remood.txt b/reactos/base/applications/rapps/rapps/remood.txt index 7ee5f97ee55..dd58417f4fa 100644 --- a/reactos/base/applications/rapps/rapps/remood.txt +++ b/reactos/base/applications/rapps/rapps/remood.txt @@ -14,5 +14,8 @@ CDPath = none [Section.0407] Description = ReMooD ist ein Port des Doom Legacy Sources. Es versucht das klassische Legacy Erfahrung zusammen mit neuen Features und mehr Stabilität zu bieten. Unterstützt werden Windows 98/98SE/ME/NT/2000/XP/2003/ Vista/2008/7/XP 64-bit/2003 64-bit/Vista 64-bit/2008 64-bit/7 64-bit; ReactOS 0.3.x und höher; und Linux (x86 und x86_64). +[Section.0415] +Description = ¯ród³owy port Doom. Jego celem jest zapewnienie rozrywki znanej z klasycznej wersji z nowymi funkcjami, i lepsz¹ stabilnoœci¹. Obs³uguje Windows 98/98SE/ME/NT/2000/XP/2003/ Vista/2008/7/XP 64-bit/2003 64-bit/Vista 64-bit/2008 64-bit/7 64-bit; ReactOS 0.3.x i wy¿sze; i Linux (x86 i x86_64). + [Section.0422] Description = ReMooD Ñ ÐŸÐ¾Ñ€Ñ‚Ð¾Ð¼ вихідних кодів Doom Legacy. Його метою Ñ” додати нові можливоÑті та ÑтабільніÑть до доÑвіду клаÑичного Legacy. Він підтримує Windows 98/98SE/ME/NT/2000/XP/2003/ Vista/2008/7/XP 64-bit/2003 64-bit/Vista 64-bit/2008 64-bit/7 64-bit; ReactOS 0.3.x та новіші; а також Linux (x86 та x86_64). diff --git a/reactos/base/applications/rapps/rapps/scite.txt b/reactos/base/applications/rapps/rapps/scite.txt index 6fe68efa4d6..bdb56884200 100644 --- a/reactos/base/applications/rapps/rapps/scite.txt +++ b/reactos/base/applications/rapps/rapps/scite.txt @@ -2,13 +2,13 @@ [Section] Name = SciTE -Version = 2.21 +Version = 2.22 Licence = Freeware Description = SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. Size = 0.6M Category = 7 URLSite = http://www.scintilla.org/ -URLDownload = http://kent.dl.sourceforge.net/project/scintilla/SciTE/2.21/Sc221.exe +URLDownload = http://kent.dl.sourceforge.net/project/scintilla/SciTE/2.22/Sc222.exe CDPath = none [Section.0407] @@ -17,5 +17,8 @@ Description = SciTE ist ein SCIntilla basierter Text Editor. Ursprünglich wurde [Section.040a] Description = Editor de texto basado en SCIntilla. Originalmente creado para demostrar Scintilla, a crecido para ser un gran editor con capacidad para crear y ejecutar programas. +[Section.0415] +Description = SciTE to edytor tekstu bazowany na SCIntilla. Oryginalnie stworzony aby pokazać Scintille, staÅ‚ sie ogólnie przydatnym edytorem z infrastrukturÄ… potrzebnÄ… do tworzenia i uruchamiania programów. + [Section.0422] Description = ТекÑтовий редактор на оÑнові SCIntilla. Був зібраний Ñк Ð¿Ñ€ÐµÐ·ÐµÐ½Ñ‚Ð°Ñ†Ñ–Ñ Scintilla, але Ð²Ð¸Ñ€Ñ–Ñ Ð´Ð¾ редактора загального кориÑÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð· заÑобами Ð·Ð±Ð¸Ñ€Ð°Ð½Ð½Ñ Ñ‚Ð° запуÑку програм. diff --git a/reactos/base/applications/rapps/rapps/seamonkey.txt b/reactos/base/applications/rapps/rapps/seamonkey.txt index 4544d24d0ac..ae5b9134110 100644 --- a/reactos/base/applications/rapps/rapps/seamonkey.txt +++ b/reactos/base/applications/rapps/rapps/seamonkey.txt @@ -2,31 +2,31 @@ [Section] Name = Mozilla SeaMonkey -Version = 2.0.9 +Version = 2.0.10 Licence = MPL/GPL/LGPL Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need. Size = 10.1MB Category = 5 URLSite = http://www.seamonkey-project.org/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/en-US/SeaMonkey%20Setup%202.0.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.10/win32/en-US/SeaMonkey%20Setup%202.0.10.exe CDPath = none [Section.0407] Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen. Size = 10.0MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/de/SeaMonkey%20Setup%202.0.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.10/win32/de/SeaMonkey%20Setup%202.0.10.exe [Section.040a] Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás. Size = 10.0MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/es-ES/SeaMonkey%20Setup%202.0.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.10/win32/es-ES/SeaMonkey%20Setup%202.0.10.exe [Section.0415] Description = Pakiet Mozilla żyje. W zestawie: przeglÄ…darka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz. Size = 10.8MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/pl/SeaMonkey%20Setup%202.0.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.10/win32/pl/SeaMonkey%20Setup%202.0.10.exe [Section.0419] Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор. Size = 10.4MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/ru/SeaMonkey%20Setup%202.0.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.10/win32/ru/SeaMonkey%20Setup%202.0.10.exe diff --git a/reactos/base/applications/rapps/rapps/steam.txt b/reactos/base/applications/rapps/rapps/steam.txt index 3caccc4e584..9d4a0af1012 100644 --- a/reactos/base/applications/rapps/rapps/steam.txt +++ b/reactos/base/applications/rapps/rapps/steam.txt @@ -14,5 +14,8 @@ CDPath = none [Section.0407] Description = Die STEAM Spieleplattform, die von viele Spielen verwendet wird. +[Section.0415] +Description = STEAM - platforma, którÄ… używa obecnie wiele gier. + [Section.0422] Description = Ігрова платформа, що викориÑтовуєтьÑÑ Ð±Ð°Ð³Ð°Ñ‚ÑŒÐ¼Ð° іграми. diff --git a/reactos/base/applications/rapps/rapps/superfinder.txt b/reactos/base/applications/rapps/rapps/superfinder.txt index 02b55605cc3..9098b11e8db 100644 --- a/reactos/base/applications/rapps/rapps/superfinder.txt +++ b/reactos/base/applications/rapps/rapps/superfinder.txt @@ -13,3 +13,6 @@ CDPath = none [Section.0407] Description = Eine schnelle und effektive Suchanwendung. + +[Section.0415] +Description = Szybka i bogata w opcje aplikacja szukajÄ…ca. diff --git a/reactos/base/applications/rapps/rapps/tahoma.txt b/reactos/base/applications/rapps/rapps/tahoma.txt index b5c87a0d3fe..c5e57fdf4b4 100644 --- a/reactos/base/applications/rapps/rapps/tahoma.txt +++ b/reactos/base/applications/rapps/rapps/tahoma.txt @@ -15,6 +15,9 @@ CDPath = none Licence = Unbekannt Description = Tahoma Font pack, der von einigen Anwendungen benötigt wird (Steam). +[Section.0415] +Description = Pakiet Czcionki Tahoma wymagany przez niektóre programy (np. Steam). + [Section.0422] Licence = Ðевідома Description = Пакет шрифтів Tahoma, що необхідні деÑким програмам (Steam). diff --git a/reactos/base/applications/rapps/rapps/thunderbird.txt b/reactos/base/applications/rapps/rapps/thunderbird.txt index 0d3fa6e3d3d..2e120b09a7c 100644 --- a/reactos/base/applications/rapps/rapps/thunderbird.txt +++ b/reactos/base/applications/rapps/rapps/thunderbird.txt @@ -2,41 +2,41 @@ [Section] Name = Mozilla Thunderbird -Version = 3.1.5 +Version = 3.1.6 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Mail Clients out there. Size = 9.0M Category = 5 URLSite = http://www.mozilla-europe.org/en/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/en-US/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/en-US/Thunderbird%20Setup%203.1.6.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Mail-Clients. Size = 8.8M URLSite = http://www.mozilla-europe.org/de/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/de/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/de/Thunderbird%20Setup%203.1.6.exe [Section.040a] Description = El más popular y uno de los mejores clientes mail que hay. Size = 8.8M URLSite = http://www.mozilla-europe.org/es/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/es-ES/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/es-ES/Thunderbird%20Setup%203.1.6.exe [Section.0415] Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty. Size = 9.7M URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/pl/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/pl/Thunderbird%20Setup%203.1.6.exe [Section.0419] Description = Один из Ñамых популÑрных и лучших беÑплатных почтовых клиентов. Size = 9.2M URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/ru/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/ru/Thunderbird%20Setup%203.1.6.exe [Section.0422] Description = ÐайпопулÑрніший та один з кращих поштових клієнтів. Size = 9.2M URLSite = http://www.mozillamessaging.com/uk/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/uk/Thunderbird%20Setup%203.1.5.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.6/win32/uk/Thunderbird%20Setup%203.1.6.exe diff --git a/reactos/base/applications/rapps/rapps/ultravnc.txt b/reactos/base/applications/rapps/rapps/ultravnc.txt index f00b1434902..89ab6740655 100644 --- a/reactos/base/applications/rapps/rapps/ultravnc.txt +++ b/reactos/base/applications/rapps/rapps/ultravnc.txt @@ -2,17 +2,20 @@ [Section] Name = UltraVNC -Version = 1.0.8.2 +Version = 1.0.9.1 Licence = GPL Description = Open-source VNC client/server. -Size = 1.9MB +Size = 2.0MB Category = 5 URLSite = http://www.uvnc.com/ -URLDownload = http://support1.uvnc.com/download/1082/UltraVNC_1.0.8.2_Setup.exe +URLDownload = http://support1.uvnc.com/download/109/UltraVNC_1.0.9.1_Setup.exe CDPath = none [Section.040a] Description = Cliente/Servidor VNC de código abierto. +[Section.0415] +Description = Otwarty klient/serwer VNC. + [Section.0422] Description = Відкритий VNC клієнт/Ñервер. diff --git a/reactos/base/applications/rapps/rapps/utorrent.txt b/reactos/base/applications/rapps/rapps/utorrent.txt index cb05f9bd3e0..86fa5ae6884 100644 --- a/reactos/base/applications/rapps/rapps/utorrent.txt +++ b/reactos/base/applications/rapps/rapps/utorrent.txt @@ -2,13 +2,13 @@ [Section] Name = µTorrent -Version = 2.0.4 +Version = 2.2 Licence = Freeware for non-commercial uses Description = Small and fast BitTorrent Client. -Size = 320K +Size = 385K Category = 5 URLSite = http://www.utorrent.com/ -URLDownload = http://download.utorrent.com/2.0.4/utorrent.exe +URLDownload = http://download.utorrent.com/2.2/utorrent.exe CDPath = none diff --git a/reactos/base/applications/rapps/rapps/vlc.txt b/reactos/base/applications/rapps/rapps/vlc.txt index 8a362fa2428..76c8c74fe8b 100644 --- a/reactos/base/applications/rapps/rapps/vlc.txt +++ b/reactos/base/applications/rapps/rapps/vlc.txt @@ -2,13 +2,13 @@ [Section] Name = VLC media player -Version = 1.1.4 +Version = 1.1.5 Licence = GPL Description = A media player. -Size = 18.7MB +Size = 19.1MB Category = 1 URLSite = http://www.videolan.org/vlc/ -URLDownload = http://ignum.dl.sourceforge.net/project/vlc/1.1.4/win32/vlc-1.1.4-win32.exe +URLDownload = http://ignum.dl.sourceforge.net/project/vlc/1.1.5/win32/vlc-1.1.5-win32.exe CDPath = none [Section.0407] @@ -20,5 +20,8 @@ Description = Reproductor multimedia. [Section.0419] Description = Мультимедийный проигрыватель. +[Section.0415] +Description = Odtwarzacz multimediów. + [Section.0422] Description = Мультимедійний програвач. diff --git a/reactos/base/applications/regedit/lang/bg-BG.rc b/reactos/base/applications/regedit/lang/bg-BG.rc index 7ecabedf807..da8521bc924 100644 --- a/reactos/base/applications/regedit/lang/bg-BG.rc +++ b/reactos/base/applications/regedit/lang/bg-BG.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Âíàñÿ ñëîâåñåí ôàéë â ðåãèñòúðà" ID_REGISTRY_EXPORTREGISTRYFILE "Èçíàñÿ öåëèÿ ðåãèñòúð èëè ÷àñòè îò íåãî â ñëîâåñåí ôàéë" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Ñâúðçâà ñå ñ ðåãèñòúðà íà äàëå÷åí êîìïþòúð" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "Ìîÿò êîìïþòúð" IDS_IMPORT_REG_FILE "Âíîñ íà ðåãèñòúðåí ôàéë" IDS_EXPORT_REG_FILE "Èçíîñ íà ðåãèñòúðåí ôàéë" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(ñàìîñòîÿòåëíà ñòîéíîñò íà äâîéíà äóìà)" END diff --git a/reactos/base/applications/regedit/lang/cs-CZ.rc b/reactos/base/applications/regedit/lang/cs-CZ.rc index c1d12dbfa95..9226c8eb36a 100644 --- a/reactos/base/applications/regedit/lang/cs-CZ.rc +++ b/reactos/base/applications/regedit/lang/cs-CZ.rc @@ -175,6 +175,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -274,6 +284,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importuje textový soubor do registru" ID_REGISTRY_EXPORTREGISTRYFILE "Exportuje všechny èásti registru do textového souboru" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Pøipojí se ke vzdálenému registru jiného poèítaèe" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -330,6 +344,8 @@ BEGIN IDS_MY_COMPUTER "Tento poèítaè" IDS_IMPORT_REG_FILE "Importovat soubor registru" IDS_EXPORT_REG_FILE "Exportovat do souboru registru" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(Neplatná hodnota DWORD)" END diff --git a/reactos/base/applications/regedit/lang/de-DE.rc b/reactos/base/applications/regedit/lang/de-DE.rc index 4cf8657a80f..8d6f251f962 100644 --- a/reactos/base/applications/regedit/lang/de-DE.rc +++ b/reactos/base/applications/regedit/lang/de-DE.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importiert eine Textddatei in die Registry" ID_REGISTRY_EXPORTREGISTRYFILE "Exportiert Teile oder die ganze Registry in eine Textdatei" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Verbindet zu einer Registry eines Fremdcomputers" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "Arbeitsplatz" IDS_IMPORT_REG_FILE "Registry importieren" IDS_EXPORT_REG_FILE "Registry exportieren" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(ungültiger DWORD-Wert)" END diff --git a/reactos/base/applications/regedit/lang/el-GR.rc b/reactos/base/applications/regedit/lang/el-GR.rc index 281ed2d299e..44ca2d9f33c 100644 --- a/reactos/base/applications/regedit/lang/el-GR.rc +++ b/reactos/base/applications/regedit/lang/el-GR.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "ÅéóÜãåé Ýíá áñ÷åßï êåéìÝíïõ óôç registry" ID_REGISTRY_EXPORTREGISTRYFILE "ÅîÜãùç üëç Þ Ýíá êïììÜôé ôçò registry óå Ýíá áñ÷åßï êåéìÝíïõ" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "ÓõíäÝååôáé óôç registry åíüò áðïìáêñõóìÝíïõ õðïëïãéóôÞ" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "Ï ÕðïëïãéóôÞò Ìïõ" IDS_IMPORT_REG_FILE "ÅéóáãùãÞ Áñ÷åßïõ Registry" IDS_EXPORT_REG_FILE "ÅîáãùãÞ Áñ÷åßïõ Registry" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(ìç Ýãêõñç DWORD ôéìÞ)" END diff --git a/reactos/base/applications/regedit/lang/es-ES.rc b/reactos/base/applications/regedit/lang/es-ES.rc index b128846bca1..0e1dc4c5d86 100644 --- a/reactos/base/applications/regedit/lang/es-ES.rc +++ b/reactos/base/applications/regedit/lang/es-ES.rc @@ -180,6 +180,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -279,6 +289,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importa un archivo de texto al registro" ID_REGISTRY_EXPORTREGISTRYFILE "Exporta todo o parte del registro a un archivo de texto" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Se conecta al registro de un ordenador remoto" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -335,6 +349,8 @@ BEGIN IDS_MY_COMPUTER "Mi PC" IDS_IMPORT_REG_FILE "Importa Fichero de Registro" IDS_EXPORT_REG_FILE "Exporta Fichero de Registro" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(valor DWORD invalido)" END diff --git a/reactos/base/applications/regedit/lang/fr-FR.rc b/reactos/base/applications/regedit/lang/fr-FR.rc index c5042da4c9a..56e31bcd755 100644 --- a/reactos/base/applications/regedit/lang/fr-FR.rc +++ b/reactos/base/applications/regedit/lang/fr-FR.rc @@ -180,6 +180,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -279,6 +289,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importe un fichier texte dans les registres" ID_REGISTRY_EXPORTREGISTRYFILE "Exporte tout ou une partie des registres dans un fichier texte" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Connecte aux registres d'un ordinateur distant" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -335,6 +349,8 @@ BEGIN IDS_MY_COMPUTER "Mon ordinateur" IDS_IMPORT_REG_FILE "Importer un fichier registre" IDS_EXPORT_REG_FILE "Exporter un fichier registre" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(valeur mot double invalide)" END diff --git a/reactos/base/applications/regedit/lang/hu-HU.rc b/reactos/base/applications/regedit/lang/hu-HU.rc index 42faef3a4ea..7efa45d5221 100644 --- a/reactos/base/applications/regedit/lang/hu-HU.rc +++ b/reactos/base/applications/regedit/lang/hu-HU.rc @@ -178,6 +178,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -277,6 +287,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry" ID_REGISTRY_EXPORTREGISTRYFILE "Exports all or part of the registry to a text file" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -333,6 +347,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(invalid DWORD value)" END diff --git a/reactos/base/applications/regedit/lang/id-ID.rc b/reactos/base/applications/regedit/lang/id-ID.rc index 059abec9576..4d8571470fe 100644 --- a/reactos/base/applications/regedit/lang/id-ID.rc +++ b/reactos/base/applications/regedit/lang/id-ID.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Mengimpor file teks ke dalam registri" ID_REGISTRY_EXPORTREGISTRYFILE "Mengekspor semua atau sebagian registri le file teks" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Menyambung ke registri komputer remote" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Impor File Registri" IDS_EXPORT_REG_FILE "Ekspor File Registri" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(nilai DWORD tidak benar)" END diff --git a/reactos/base/applications/regedit/lang/it-IT.rc b/reactos/base/applications/regedit/lang/it-IT.rc index 53c68565cb2..8f81f05ea36 100644 --- a/reactos/base/applications/regedit/lang/it-IT.rc +++ b/reactos/base/applications/regedit/lang/it-IT.rc @@ -180,6 +180,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -281,6 +291,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importa un file di testo nel Registro" ID_REGISTRY_EXPORTREGISTRYFILE "Esporta tutto o parte del Registro in un file di testo" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Si connette al Registro di un computer remoto" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -337,6 +351,8 @@ BEGIN IDS_MY_COMPUTER "Il mio Computer" IDS_IMPORT_REG_FILE "Importa file di Registro" IDS_EXPORT_REG_FILE "Esporta file di Registro" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(valore DWORD non valido)" END diff --git a/reactos/base/applications/regedit/lang/ja-JP.rc b/reactos/base/applications/regedit/lang/ja-JP.rc index 8b1816bf03f..66a0967fb17 100644 --- a/reactos/base/applications/regedit/lang/ja-JP.rc +++ b/reactos/base/applications/regedit/lang/ja-JP.rc @@ -175,6 +175,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -274,6 +284,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "ƒeƒLƒXƒg ƒtƒ@ƒCƒ‹‚ðƒŒƒWƒXƒgƒŠ‚ɃCƒ“ƒ|[ƒg‚µ‚Ü‚·B" ID_REGISTRY_EXPORTREGISTRYFILE "ƒŒƒWƒXƒgƒŠ‚̈ꕔ‚Ü‚½‚Í‘S‘Ì‚ðƒeƒLƒXƒg ƒtƒ@ƒCƒ‹‚ɃGƒNƒXƒ|[ƒg‚µ‚Ü‚·B" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "ƒŠƒ‚[ƒg ƒRƒ“ƒsƒ…[ƒ^‚̃ŒƒWƒXƒgƒŠ‚ÉÚ‘±‚µ‚Ü‚·B" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -330,6 +344,8 @@ BEGIN IDS_MY_COMPUTER "ƒ}ƒC ƒRƒ“ƒsƒ…[ƒ^" IDS_IMPORT_REG_FILE "ƒŒƒWƒXƒgƒŠ ƒtƒ@ƒCƒ‹‚̃Cƒ“ƒ|[ƒg" IDS_EXPORT_REG_FILE "ƒŒƒWƒXƒgƒŠ ƒtƒ@ƒCƒ‹‚̃GƒNƒXƒ|[ƒg" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(–³Œø‚È DWORD ’l)" END diff --git a/reactos/base/applications/regedit/lang/ko-KR.rc b/reactos/base/applications/regedit/lang/ko-KR.rc index 01777d0344b..b2057978fca 100644 --- a/reactos/base/applications/regedit/lang/ko-KR.rc +++ b/reactos/base/applications/regedit/lang/ko-KR.rc @@ -162,6 +162,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -261,6 +271,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "ÅØ½ºÆ® ÆÄÀÏÀ» ·¹Áö½ºÆ®¸®·Î ºÒ·¯ ¿É´Ï´Ù" ID_REGISTRY_EXPORTREGISTRYFILE "ÅØ½ºÆ® ÆÄÀÏ·Î ·¹Áö½ºÆ®¸®ÀÇ Àüü³ª ÀϺθ¦ ³»º¸³À´Ï´Ù" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "¿ø°Ý ÄÄÇ»ÅÍÀÇ ·¹Áö½ºÆ®¸®·Î Á¢¼ÓÇÕ´Ï´Ù" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -317,6 +331,8 @@ BEGIN IDS_MY_COMPUTER "³» ÄÄÇ»ÅÍ" IDS_IMPORT_REG_FILE "·¹Áö½ºÆ®¸® ÆÄÀÏ ºÒ·¯¿À±â" IDS_EXPORT_REG_FILE "·¹Áö½ºÆ®¸® ÆÄÀÏ ³»º¸³»±â" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(À߸øµÈ DWORD°ª)" END diff --git a/reactos/base/applications/regedit/lang/nl-NL.rc b/reactos/base/applications/regedit/lang/nl-NL.rc index be86610e59c..2bc09796371 100644 --- a/reactos/base/applications/regedit/lang/nl-NL.rc +++ b/reactos/base/applications/regedit/lang/nl-NL.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Een tekstbestand in het register importeren" ID_REGISTRY_EXPORTREGISTRYFILE "Het register of een gedeelte ervan naar een tekstbestand exporteren" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Een verbinding maken met het register van een externe computer" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(invalid DWORD value)" END diff --git a/reactos/base/applications/regedit/lang/no-NO.rc b/reactos/base/applications/regedit/lang/no-NO.rc index b052432f8ec..60d0d1af091 100644 --- a/reactos/base/applications/regedit/lang/no-NO.rc +++ b/reactos/base/applications/regedit/lang/no-NO.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importerer en tekstfil inn i Registret" ID_REGISTRY_EXPORTREGISTRYFILE "Eksporterer hele eller deler av Registret til en tekstfil" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Kobler til Registret på en annen datamaskin" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "Min datamaskin" IDS_IMPORT_REG_FILE "Importer registerfil" IDS_EXPORT_REG_FILE "Eksporter registerfil" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(ugyldig DWORD-verdi)" END diff --git a/reactos/base/applications/regedit/lang/pl-PL.rc b/reactos/base/applications/regedit/lang/pl-PL.rc index 198125c772c..4f864f3df01 100644 --- a/reactos/base/applications/regedit/lang/pl-PL.rc +++ b/reactos/base/applications/regedit/lang/pl-PL.rc @@ -182,6 +182,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -281,6 +291,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importuje plik do rejestru" ID_REGISTRY_EXPORTREGISTRYFILE "Eksportuje ca³oœæ lub czêœæ rejestru do pliku" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Po³¹czenie z rejestrem zdalnego komputera" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -337,6 +351,8 @@ BEGIN IDS_MY_COMPUTER "Mój komputer" IDS_IMPORT_REG_FILE "Importuj plik rejestru" IDS_EXPORT_REG_FILE "Eksportuj plik rejestru" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(niew³aœciwa wartoœæ DWORD)" END diff --git a/reactos/base/applications/regedit/lang/pt-BR.rc b/reactos/base/applications/regedit/lang/pt-BR.rc index 4cd21990e30..7abc3c211ba 100644 --- a/reactos/base/applications/regedit/lang/pt-BR.rc +++ b/reactos/base/applications/regedit/lang/pt-BR.rc @@ -178,6 +178,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -277,6 +287,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importa um arquivo de texto para o registro" ID_REGISTRY_EXPORTREGISTRYFILE "Exporta todo ou parte do Registro para um arquivo texto" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Conecta-se ao Registro de um computador remoto" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -333,6 +347,8 @@ BEGIN IDS_MY_COMPUTER "Meu computador" IDS_IMPORT_REG_FILE "Importar arquivo do Registro" IDS_EXPORT_REG_FILE "Exportar arquivo do Registro" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(valor DWORD inválido)" END diff --git a/reactos/base/applications/regedit/lang/pt-PT.rc b/reactos/base/applications/regedit/lang/pt-PT.rc index 15fee2f3166..52b15fd526c 100644 --- a/reactos/base/applications/regedit/lang/pt-PT.rc +++ b/reactos/base/applications/regedit/lang/pt-PT.rc @@ -277,6 +277,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importa um arquivo texto para o registro." ID_REGISTRY_EXPORTREGISTRYFILE "Exporta todo ou parte do registro para um arquivo texto." + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Conecta a um registro em um computador remoto." ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -333,6 +337,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(invalid DWORD value)" END @@ -384,6 +390,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EXPORTRANGE DIALOGEX DISCARDABLE 50, 50, 370, 50 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | diff --git a/reactos/base/applications/regedit/lang/ru-RU.rc b/reactos/base/applications/regedit/lang/ru-RU.rc index 62892800f15..f8e74660ab9 100644 --- a/reactos/base/applications/regedit/lang/ru-RU.rc +++ b/reactos/base/applications/regedit/lang/ru-RU.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -275,6 +285,8 @@ BEGIN ID_EDIT_NEW_DWORDVALUE "Äîáàâëÿåò íîâîå DWORD-çíà÷åíèå" ID_REGISTRY_IMPORTREGISTRYFILE "Èìïîðòèðóåò òåêñòîâîé ôàéë â ðååñòð" ID_REGISTRY_EXPORTREGISTRYFILE "Ýêñïîðòèðóåò âåñü ðååñòð èëè åãî ÷àñòü â òåêñòîâîé ôàéë" + ID_REGISTRY_LOADHIVE "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Ïîäêëþ÷àåòñÿ ê ðååñòðó óäàë¸ííîãî êîìïüþòåðà" @@ -332,6 +344,8 @@ BEGIN IDS_MY_COMPUTER "Ìîé êîìïüþòåð" IDS_IMPORT_REG_FILE "Èìïîðòèðîâàíèå ôàéëà ðååñòðà" IDS_EXPORT_REG_FILE "Ýêñïîðòèðîâàíèå ôàéëà ðååñòðà" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(íåïðàâèëüíîå çíà÷åíèå DWORD)" END diff --git a/reactos/base/applications/regedit/lang/sk-SK.rc b/reactos/base/applications/regedit/lang/sk-SK.rc index f5437e9cb65..b6cb4754993 100644 --- a/reactos/base/applications/regedit/lang/sk-SK.rc +++ b/reactos/base/applications/regedit/lang/sk-SK.rc @@ -162,6 +162,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -261,6 +271,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry" ID_REGISTRY_EXPORTREGISTRYFILE "Exports all or part of the registry to a text file" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -317,6 +331,8 @@ BEGIN IDS_MY_COMPUTER "Tento poèítaè" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(neplatná DWORD hodnota)" END diff --git a/reactos/base/applications/regedit/lang/sl-SI.rc b/reactos/base/applications/regedit/lang/sl-SI.rc index d5c5804c881..0be7a429a8a 100644 --- a/reactos/base/applications/regedit/lang/sl-SI.rc +++ b/reactos/base/applications/regedit/lang/sl-SI.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "V register uvozi datoteko z besedilom" ID_REGISTRY_EXPORTREGISTRYFILE "Registrsko datoteko ali njen del izvozi v besedilno datoteko" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Vzpostavi povezavo z registrom oddaljenega raèunalnika" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(invalid DWORD value)" END diff --git a/reactos/base/applications/regedit/lang/sv-SE.rc b/reactos/base/applications/regedit/lang/sv-SE.rc index ee1515dd08b..70832d3e573 100644 --- a/reactos/base/applications/regedit/lang/sv-SE.rc +++ b/reactos/base/applications/regedit/lang/sv-SE.rc @@ -175,6 +175,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -274,6 +284,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Importerar en textfil till registret" ID_REGISTRY_EXPORTREGISTRYFILE "Exporterar hela eller en del av registret till en textfil" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Ansluter till en annan dators register" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -330,6 +344,8 @@ BEGIN IDS_MY_COMPUTER "Den här datorn" IDS_IMPORT_REG_FILE "Importera registerfil" IDS_EXPORT_REG_FILE "Exportera registerfil" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(felaktigt DWORD-värde)" END diff --git a/reactos/base/applications/regedit/lang/th-TH.rc b/reactos/base/applications/regedit/lang/th-TH.rc index c7bb7fde7d9..51aa5da0a8f 100644 --- a/reactos/base/applications/regedit/lang/th-TH.rc +++ b/reactos/base/applications/regedit/lang/th-TH.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry" ID_REGISTRY_EXPORTREGISTRYFILE "Exports all or part of the registry to a text file" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "Import Registry File" IDS_EXPORT_REG_FILE "Export Registry File" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(invalid DWORD value)" END diff --git a/reactos/base/applications/regedit/lang/uk-UA.rc b/reactos/base/applications/regedit/lang/uk-UA.rc index 5fd1fa5ec45..6f98e38c0eb 100644 --- a/reactos/base/applications/regedit/lang/uk-UA.rc +++ b/reactos/base/applications/regedit/lang/uk-UA.rc @@ -178,6 +178,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -277,6 +287,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "²ìïîðòóº òåêñòîâèé ôàéë äî ðåºñòðó" ID_REGISTRY_EXPORTREGISTRYFILE "Åêñïîðòóº âåñü ðåºñòð àáî éîãî ÷àñòèíó â òåêñòîâèé ôàéë" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "ϳäêëþ÷àºòüñÿ äî ðåºñòðó â³ääàëåíîãî êîìï'þòåðà" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -333,6 +347,8 @@ BEGIN IDS_MY_COMPUTER "̳é êîìï'þòåð" IDS_IMPORT_REG_FILE "²ìïîðòóâàòè ôàéë ðåºñòðó" IDS_EXPORT_REG_FILE "Åêñïîðòóâàòè ôàéë ðåºñòðó" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(Íåïðàâèëüíå çíà÷åííÿ DWORD)" END diff --git a/reactos/base/applications/regedit/lang/zh-CN.rc b/reactos/base/applications/regedit/lang/zh-CN.rc index 0d20667cdd3..8e098469ad3 100644 --- a/reactos/base/applications/regedit/lang/zh-CN.rc +++ b/reactos/base/applications/regedit/lang/zh-CN.rc @@ -177,6 +177,16 @@ END /* * Dialog */ +IDD_LOADHIVE DIALOGEX DISCARDABLE 0, 0, 193, 34 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Load Hive" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "&Key:", IDC_STATIC, 4, 4, 15, 8, SS_LEFT + EDITTEXT IDC_EDIT_KEY, 23, 2, 167, 13 + DEFPUSHBUTTON "OK", IDOK, 140, 17, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 89, 17, 50, 14 +} IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | @@ -276,6 +286,10 @@ BEGIN ID_REGISTRY_IMPORTREGISTRYFILE "½«Îļþµ¼Èëµ½×¢²á±íÖС£" ID_REGISTRY_EXPORTREGISTRYFILE "½«×¢²á±íÈ«²¿»ò²¿·Öµ¼³öµ½ÎļþÖС£" + ID_REGISTRY_LOADHIVE + "Loads a hive file into the registry" + ID_REGISTRY_UNLOADHIVE + "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Á¬½Óµ½Ô¶³Ì¼ÆËã»úµÄ×¢²á±í¡£" ID_REGISTRY_DISCONNECTNETWORKREGISTRY @@ -332,6 +346,8 @@ BEGIN IDS_MY_COMPUTER "My Computer" IDS_IMPORT_REG_FILE "µ¼Èë×¢²á±íÎļþ" IDS_EXPORT_REG_FILE "µ¼³ö×¢²á±íÎļþ" + IDS_LOAD_HIVE "Load Hive" + IDS_UNLOAD_HIVE "Unload Hive" IDS_INVALID_DWORD "(²»ÕýÈ·µÄ DWORD Öµ)" END diff --git a/reactos/base/setup/usetup/lang/sk-SK.h b/reactos/base/setup/usetup/lang/sk-SK.h index 73117a45a46..6c35e8da169 100644 --- a/reactos/base/setup/usetup/lang/sk-SK.h +++ b/reactos/base/setup/usetup/lang/sk-SK.h @@ -1,7 +1,7 @@ /* TRANSLATOR: M rio KaŸm r /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR: 22-01-2008 * Encoding : Latin II (852) - * LastChange: 31-05-2010 + * LastChange: 05-09-2010 */ #pragma once @@ -993,13 +993,13 @@ static MUI_ENTRY skSKBootLoaderEntries[] = { 8, 12, - "Install bootloader on the harddisk (MBR and VBR).", + "Nainçtalovaœ zav dzaŸ syst‚mu na pevnì disk (MBR a VBR).", TEXT_STYLE_NORMAL }, { 8, 13, - "Install bootloader on the harddisk (VBR only).", + "Nainçtalovaœ zav dzaŸ syst‚mu na pevnì disk (iba VBR).", TEXT_STYLE_NORMAL }, { diff --git a/reactos/base/shell/cmd/lang/sk-SK.rc b/reactos/base/shell/cmd/lang/sk-SK.rc index f436e5c6990..cec75b04ef3 100644 --- a/reactos/base/shell/cmd/lang/sk-SK.rc +++ b/reactos/base/shell/cmd/lang/sk-SK.rc @@ -1,9 +1,9 @@ /* Slovak translation for CMD * TRANSLATOR: Mário Kaèmár /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR: 21-03-2009 - * LastChange: 21-06-2009 + * LastChange: 10-08-2010 * _________________________________________________________________ - * NOTE : this file is not really translated (only scrap yet) + * NOTE : this file is not fully translated */ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT @@ -118,7 +118,7 @@ dec hex name dec hex name\n\ 6 6 Yellow 14 E Bright Yellow\n\ 7 7 White 15 F Bright White\n" -STRING_COPY_HELP1, "Overwrite %s (Yes/No/All)? " +STRING_COPY_HELP1, "Prepísa %s (Yes/No/All)? " STRING_COPY_HELP2, "Skopíruje jeden alebo viac súborov na iné umiestnenie.\n\n\ COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n\ @@ -141,7 +141,7 @@ STRING_DATE_HELP2, "\nZadajte nov STRING_DATE_HELP3, "\nZadajte nový dátum (rrrr%cmm%cdd): " -STRING_DATE_HELP4, "Displays or sets the date.\n\n\ +STRING_DATE_HELP4, "Zobrazí alebo nastaví dátum.\n\n\ DATE [/T][date]\n\n\ /T display only\n\n\ Type DATE without parameters to display the current date setting and\n\ @@ -469,7 +469,7 @@ STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n\ TITLE [string]\n\n\ string Specifies the title for the command prompt window.\n" -STRING_TIME_HELP1, "Displays or sets the system time.\n\n\ +STRING_TIME_HELP1, "Zobrazí alebo nastaví systémový èas.\n\n\ TIME [/T][time]\n\n\ /T display only\n\n\ Type TIME with no parameters to display the current time setting and a prompt\n\ @@ -547,18 +547,18 @@ STRING_WINDOW_HELP1, "change console window aspect\n\n\ WINDOW [/POS[=]left,top,width,heigth]\n\ [MIN|MAX|RESTORE] ['title']\n\n\ /POS specify window placement and dimensions\n\ -MIN minimize the window\n\ -MAX maximize the window\n\ -RESTORE restore the window" +MIN minimalizova okno\n\ +MAX maximalizujte okno\n\ +RESTORE obnovi okno" STRING_WINDOW_HELP2, "change console window aspect\n\n\ ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\ [MIN|MAX|RESTORE] ['title']\n\n\ window tile of window on which perform actions\n\ /POS specify window placement and dimensions\n\ -MIN minimize the window\n\ -MAX maximize the window\n\ -RESTORE restore the window\n\ +MIN minimalizova okno\n\ +MAX maximalizujte okno\n\ +RESTORE obnovi okno\n\ title new title\n" @@ -576,7 +576,7 @@ CLS Vyma CMD Starts a new instance of the ReactOS command interpreter.\n\ COLOR Sets the default console foreground and background colors.\n\ COPY Skopíruje jeden alebo viac súborov na iné umiestnenie.\n\ -DATE Displays or sets the date.\n\ +DATE Zobrazí alebo nastaví dátum.\n\ DELETE Deletes one or more files.\n\ DIR Displays a list of files and subdirectories in a directory.\n\ ECHO Displays messages, or turns command echoing on or off.\n\ @@ -590,8 +590,8 @@ HELP Provides Help information for ReactOS commands.\n\ HISTORY List all commands which has been used\n\ IF Performs conditional processing in batch programs.\n\ LABEL Creates, changes, or deletes the volume label of a disk.\n\ -MD Creates a directory.\n\ -MKDIR Creates a directory.\n\ +MD Vytvorí adresár.\n\ +MKDIR Vytvorí adresár.\n\ MKLINK Creates a filesystem link object.\n\ MOVE Moves one or more files from one directory to another\n\ directory.\n\ @@ -603,8 +603,8 @@ PROMPT Changes the command prompt.\n\ PUSHD Saves the current directory then changes it.\n\ RD Removes a directory.\n\ REM Records comments (remarks) in batch files.\n\ -REN Renames a file or files.\n\ -RENAME Renames a file or files.\n\ +REN Premenuje súbor alebo súbory.\n\ +RENAME Premenuje súbor alebo súbory.\n\ REPLACE Replaces files.\n\ RMDIR Removes a directory.\n\ SCREEN Move cursor and optionally print text.\n\ @@ -612,7 +612,7 @@ SET Displays, sets, or removes ReactOS environment variables.\n\ SHIFT Shifts the position of replaceable parameters in batch files.\n" STRING_HELP2, "START Starts a separate window to run a specified program or command.\n\ Executes command.\n\ -TIME Displays or sets the system time.\n\ +TIME Zobrazí alebo nastaví systémový èas.\n\ TIMER Allow the use of ten stopwatches.\n\ TITLE Sets the window title for a CMD.EXE session.\n\ TYPE Displays the contents of a text file.\n\ @@ -651,9 +651,9 @@ STRING_COPY_ERROR3, "Error writing destination!\n" STRING_COPY_ERROR4, "Chyba: Zatia¾ neimplementované!\n" //Not implemented yet STRING_DATE_ERROR, "Neplatný dátum." STRING_DEL_ERROR5, "The file %s will be deleted! " -STRING_DEL_ERROR6, "Are you sure (Y/N)?" +STRING_DEL_ERROR6, "Ste si istý (Y/N)?" STRING_DEL_ERROR7, "Deleting: %s\n" -STRING_ERROR_ERROR1, "Unknown error! Error code: 0x%lx\n" +STRING_ERROR_ERROR1, "Neznáma chyba! Kód chyby: 0x%lx\n" STRING_ERROR_ERROR2, "Syntax error" STRING_FOR_ERROR1, "'in' missing in for statement." STRING_FOR_ERROR2, "no brackets found." @@ -675,47 +675,47 @@ STRING_TIME_ERROR1, "Neplatn STRING_TYPE_ERROR1, "Invalid option '/%s'\n" -STRING_WINDOW_ERROR1, "window not found" +STRING_WINDOW_ERROR1, "okno sa nenašlo" STRING_ERROR_PARAMETERF_ERROR, "Parameter format not correct - %c\n" -STRING_ERROR_INVALID_SWITCH, "Invalid switch - /%c\n" +STRING_ERROR_INVALID_SWITCH, "Neplatný prepínaè - /%c\n" STRING_ERROR_TOO_MANY_PARAMETERS, "Príliš ve¾a parametrov - %s\n" -STRING_ERROR_PATH_NOT_FOUND, "Path not found\n" -STRING_ERROR_FILE_NOT_FOUND, "File not found\n" +STRING_ERROR_PATH_NOT_FOUND, "Cesta sa nenašla\n" +STRING_ERROR_FILE_NOT_FOUND, "Súbor sa nenašiel\n" STRING_ERROR_REQ_PARAM_MISSING, "Required parameter missing\n" STRING_ERROR_INVALID_DRIVE, "Invalid drive specification\n" STRING_ERROR_INVALID_PARAM_FORMAT, "Invalid parameter format - %s\n" -STRING_ERROR_BADCOMMAND, "Bad command or filename - %s\n" +STRING_ERROR_BADCOMMAND, "Chybný príkaz alebo názov súboru - %s\n" STRING_ERROR_OUT_OF_MEMORY, "Chyba (z) nedostatku pamäte.\n" //Out of memory error. -STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary file!\n" +STRING_ERROR_CANNOTPIPE, "Chyba! Cannot pipe! Cannot open temporary file!\n" STRING_ERROR_D_PAUSEMSG, "Pokraèujte stlaèením ¾ubovo¾ného klávesu ..." -STRING_ERROR_DRIVER_NOT_READY, "Drive not ready" +STRING_ERROR_DRIVER_NOT_READY, "Jednotka nie je pripravená" STRING_PATH_ERROR, "CMD: Not in environment '%s'\n" -STRING_REPLACE_ERROR1, "Invalid switch - %s\n" -STRING_REPLACE_ERROR2, "Path not found - %s\n" +STRING_REPLACE_ERROR1, "Neplatný prepínaè - %s\n" +STRING_REPLACE_ERROR2, "Cesta sa nenašla - %s\n" STRING_REPLACE_ERROR3, "The filename, directory name, or volume label syntax is incorrect.\n" STRING_REPLACE_ERROR4, "Invalid parameter combination\n" -STRING_REPLACE_ERROR5, "Access denied - %s\n" -STRING_REPLACE_ERROR6, "No files found - %s\n" +STRING_REPLACE_ERROR5, "Prístup zamietnutý - %s\n" +STRING_REPLACE_ERROR6, "Žiadne súbory sa nenašli - %s\n" STRING_REPLACE_ERROR7, "Extended Error 32\n" STRING_REACTOS_VERSION, "Operaèný systém ReactOS [Verzia %s-%s]\n" -STRING_CMD_SHELLINFO, "\nReactOS Command Line Interpreter\nVerzia %s %s" +STRING_CMD_SHELLINFO, "\nInterpréter príkazového riadku systému ReactOS\nVerzia %s %s" STRING_VERSION_RUNVER, " running on %s" STRING_COPY_FILE , " %d súbor(ov) skopírovaný(ch)\n" STRING_DELETE_WIPE, "wiped" STRING_FOR_ERROR, "bad variable specification." -STRING_SCREEN_COL, "invalid value for col" -STRING_SCREEN_ROW, "invalid value for row" +STRING_SCREEN_COL, "neplatná hodnota pre ståpec" +STRING_SCREEN_ROW, "neplatná hodnota pre riadok" STRING_TIMER_TIME "Timer %d is %s: " STRING_MKLINK_CREATED_SYMBOLIC, "Symbolic link created for %s <<===>> %s\n" STRING_MKLINK_CREATED_HARD, "Hard link created for %s <<===>> %s\n" STRING_MKLINK_CREATED_JUNCTION, "Junction created for %s <<===>> %s\n" STRING_MORE, "Viac? " //"More? " -STRING_CANCEL_BATCH_FILE, "\r\nCtrl-Break pressed. Cancel batch file? (Yes/No/All) " +STRING_CANCEL_BATCH_FILE, "\r\nStlaèené Ctrl-Break. Cancel batch file? (Yes/No/All) " STRING_INVALID_OPERAND, "Invalid operand." STRING_EXPECTED_CLOSE_PAREN, "Oèakávaná ')'." diff --git a/reactos/base/system/format/lang/sk-SK.rc b/reactos/base/system/format/lang/sk-SK.rc index deaee258367..c40b08fc2b6 100644 --- a/reactos/base/system/format/lang/sk-SK.rc +++ b/reactos/base/system/format/lang/sk-SK.rc @@ -1,6 +1,6 @@ /* TRANSLATOR : M rio KaŸm r /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR.: 15-02-2008 - * LAST CHANGE: 08-08-2008 + * LAST CHANGE: 10-08-2010 */ #include "resource.h" @@ -14,14 +14,14 @@ STRING_HELP, "Pou -FS:syst‚m s£borov UrŸuje typ s£borov‚ho syst‚mu (%s).\n\ -V:menovka UrŸuje menovku zv„zku.\n\ -Q Vykon va rìchle form tovanie.\n\ - -A:ve–kosœ Overrides the default allocation unit size. Default settings\n\ - are strongly recommended for general use\n\ - NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ - FAT supports 8192, 16K, 32K, 64K, 128K, 256K.\n\ - NTFS compression is not supported for allocation unit sizes\n\ - above 4096.\n\ - -C Files created on the new volume will be compressed by\n\ - default.\n\n" + -A:ve–kosœ Prep¡çe predvolen£ ve–kosœ alokaŸnej jednotky. Pre vçeobecn‚\n\ + pou§itie s£ d“razne odpor£Ÿan‚ predvolen‚ nastavenia\n\ + NTFS podporuje 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ + FAT podporuje 8192, 16K, 32K, 64K, 128K, 256K.\n\ + NTFS kompresia nie je podporovan  pre ve–kosti alokaŸnej\n\ + jednotky nad 4096.\n\ + -C S£bory vytvoren‚ na novom zv„zku bud£ automaticky\n\ + komprimovan‚.\n\n" STRING_COMPLETE "DokonŸen‚ na %lu percent.\r" @@ -29,19 +29,19 @@ STRING_FORMAT_FAIL "FormatEx nebol schopn STRING_NO_SUPPORT "Oper cia nie je podporovan " -STRING_FMIFS_FAIL "Could not located FMIFS entry points.\n\n" +STRING_FMIFS_FAIL "Nepodarilo sa lokalizovaœ vstupn‚ body FMIFS.\n\n" STRING_UNKNOW_ARG "Nezn my argument: %s\n" STRING_DRIVE_PARM "Chìba nevyhnutnì parameter jednotky.\n\n" -STRING_ERROR_DRIVE_TYPE "Could not get drive type" +STRING_ERROR_DRIVE_TYPE "Nemo§no z¡skaœ typ jednotky" STRING_INSERT_DISK "Vlo§te nov£ disketu do jednotky %C:\na potom stlaŸte ENTER..." -STRING_NO_VOLUME "Could not query volume" +STRING_NO_VOLUME "Nemo§no dotazovaœ zv„zok" -STRING_NO_VOLUME_SIZE "Could not query volume size" +STRING_NO_VOLUME_SIZE "Nemo§no dotazovaœ ve–kosœ zv„zku" STRING_FILESYSTEM "Typ syst‚mu s£borov je %s.\n" @@ -49,8 +49,8 @@ STRING_LABEL_NAME_EDIT "Vlo STRING_ERROR_LABEL "Bola zadan  nespr vna menovka zv„zku pre t£to jednotku.\n" -STRING_YN_FORMAT "\nWARNING, ALL DATA ON NON_REMOVABLE DISK\n\ -DRIVE %C: WILL BE LOST!\nProceed with Format (A/N)? " +STRING_YN_FORMAT "\nUPOZORNENIE: VæETKY éDAJE NA NIE_VYMENITE•NEJ DISKOVEJ\n\ +JEDNOTKE %C: BUDé STRATEN!\nPokraŸovaœ s form tovan¡m (A/N)? " STRING_YES_NO_FAQ "AN" From 7a5f1379747c32aedc5f9efdeb6ae24ac4fea7f2 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 15 Nov 2010 06:52:44 +0000 Subject: [PATCH 022/132] [Win32k] - Fix hooks, do not cleanup hooks when any window from the same thread is destroyed. svn path=/trunk/; revision=49592 --- reactos/subsystems/win32/win32k/ntuser/window.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index dd714cd9483..046515ce454 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -402,8 +402,6 @@ static LRESULT co_UserFreeWindow(PWND Window, DestroyTimersForWindow(ThreadData, Window); - HOOK_DestroyThreadHooks(ThreadData->pEThread); // This is needed here too! - /* flush the message queue */ MsqRemoveWindowMessagesFromQueue(Window); From 3d573b97a6b8ecd53a84bd4d492ce778a7e28e37 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 16 Nov 2010 04:52:53 +0000 Subject: [PATCH 023/132] [Win32k] - Tweaks to hook and event timeouts. Increase performance with DOSBox when using mouse and keyboard. svn path=/trunk/; revision=49605 --- .../subsystems/win32/win32k/ntuser/event.c | 2 +- reactos/subsystems/win32/win32k/ntuser/hook.c | 97 +++++++------------ 2 files changed, 38 insertions(+), 61 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/event.c b/reactos/subsystems/win32/win32k/ntuser/event.c index e768c2e09d0..cdc2092439a 100644 --- a/reactos/subsystems/win32/win32k/ntuser/event.c +++ b/reactos/subsystems/win32/win32k/ntuser/event.c @@ -120,7 +120,7 @@ IntCallLowLevelEvent( PEVENTHOOK pEH, event, 0, (LPARAM)pEP, - 5000, + 300, TRUE, MSQ_ISEVENT, &uResult); diff --git a/reactos/subsystems/win32/win32k/ntuser/hook.c b/reactos/subsystems/win32/win32k/ntuser/hook.c index 089f92beb75..f41d7bad0ce 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hook.c +++ b/reactos/subsystems/win32/win32k/ntuser/hook.c @@ -38,6 +38,8 @@ IntCallLowLevelHook( PHOOK Hook, PTHREADINFO pti; PHOOKPACK pHP; INT Size; + UINT uTimeout = 300; + BOOL Block = FALSE; ULONG_PTR uResult = 0; if (Hook->Thread) @@ -53,25 +55,13 @@ IntCallLowLevelHook( PHOOK Hook, pHP->pHookStructs = NULL; Size = 0; -// Once the rest is enabled again, This prevents stack corruption from the caller. +// This prevents stack corruption from the caller. switch(Hook->HookId) { - case WH_CBT: - switch(Code) - { - case HCBT_CREATEWND: - Size = sizeof(CBT_CREATEWNDW); - break; - case HCBT_MOVESIZE: - Size = sizeof(RECTL); - break; - case HCBT_ACTIVATE: - Size = sizeof(CBTACTIVATESTRUCT); - break; - case HCBT_CLICKSKIPPED: - Size = sizeof(MOUSEHOOKSTRUCT); - break; - } + case WH_JOURNALPLAYBACK: + case WH_JOURNALRECORD: + uTimeout = 0; + Size = sizeof(EVENTMSG); break; case WH_KEYBOARD_LL: Size = sizeof(KBDLLHOOKSTRUCT); @@ -80,18 +70,14 @@ IntCallLowLevelHook( PHOOK Hook, Size = sizeof(MSLLHOOKSTRUCT); break; case WH_MOUSE: + uTimeout = 200; + Block = TRUE; Size = sizeof(MOUSEHOOKSTRUCT); break; - case WH_CALLWNDPROC: - Size = sizeof(CWPSTRUCT); - break; - case WH_CALLWNDPROCRET: - Size = sizeof(CWPRETSTRUCT); - break; - case WH_MSGFILTER: - case WH_SYSMSGFILTER: - case WH_GETMESSAGE: - Size = sizeof(MSG); + case WH_KEYBOARD: + uTimeout = 200; + Block = TRUE; + Size = sizeof(KBDLLHOOKSTRUCT); break; } @@ -107,9 +93,9 @@ IntCallLowLevelHook( PHOOK Hook, IntToPtr(Code), // hWnd Hook->HookId, // Msg wParam, - (LPARAM)pHP, - 5000, - TRUE, + (LPARAM)pHP, + uTimeout, + Block, MSQ_ISHOOK, &uResult); if (!NT_SUCCESS(Status)) @@ -141,25 +127,12 @@ co_CallHook( INT HookId, switch(HookId) { - case WH_CBT: - switch(Code) - { - case HCBT_CREATEWND: - case HCBT_MOVESIZE: - case HCBT_ACTIVATE: - case HCBT_CLICKSKIPPED: - lParam = (LPARAM)pHP->pHookStructs; - break; - } - break; + case WH_JOURNALPLAYBACK: + case WH_JOURNALRECORD: + case WH_KEYBOARD: case WH_KEYBOARD_LL: case WH_MOUSE_LL: case WH_MOUSE: - case WH_CALLWNDPROC: - case WH_CALLWNDPROCRET: - case WH_MSGFILTER: - case WH_SYSMSGFILTER: - case WH_GETMESSAGE: lParam = (LPARAM)pHP->pHookStructs; break; } @@ -187,12 +160,6 @@ co_HOOK_CallHookNext( PHOOK Hook, WPARAM wParam, LPARAM lParam) { - if ( (Hook->Thread != PsGetCurrentThread()) && (Hook->Thread != NULL) ) - { - DPRINT1("Calling Next HOOK from another Thread. %d\n", Hook->HookId); - return IntCallLowLevelHook(Hook, Code, wParam, lParam); - } - DPRINT("Calling Next HOOK %d\n", Hook->HookId); return co_IntCallHookProc( Hook->HookId, @@ -989,7 +956,10 @@ co_HOOK_CallHooks( INT HookId, pti->fsHooks most likely, is zero. So process KbT & MsT to "send" the message. */ if ( !pti || !pdo || (!(HookId == WH_KEYBOARD_LL) && !(HookId == WH_MOUSE_LL)) ) + { + DPRINT("No PDO %d\n", HookId); goto Exit; + } } else { @@ -997,7 +967,10 @@ co_HOOK_CallHooks( INT HookId, } if ( pti->TIF_flags & (TIF_INCLEANUP|TIF_DISABLEHOOKS)) + { + DPRINT("Hook Thread dead %d\n", HookId); goto Exit; + } if ( ISITHOOKED(HookId) ) { @@ -1104,11 +1077,13 @@ co_HOOK_CallHooks( INT HookId, // Lockup the thread while this links through user world. ObReferenceObject(ptiHook->pEThread); if (ptiHook != pti ) - { - /* This fixed the ros regtest. Wine does this too. Need more time - to investigate this. MSDN "Hooks Overview" can't be wrong? - */ - if (HookId == WH_KEYBOARD_LL || HookId == WH_MOUSE_LL) + { // Block | TimeOut + if ( HookId == WH_JOURNALPLAYBACK || // 1 | 0 + HookId == WH_JOURNALRECORD || // 1 | 0 + HookId == WH_KEYBOARD || // 1 | 200 + HookId == WH_MOUSE || // 1 | 200 + HookId == WH_KEYBOARD_LL || // 0 | 300 + HookId == WH_MOUSE_LL ) // 0 | 300 { DPRINT("\nGlobal Hook posting to another Thread! %d\n",HookId ); Result = IntCallLowLevelHook(Hook, Code, wParam, lParam); @@ -1281,7 +1256,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, DPRINT("Enter NtUserSetWindowsHookEx\n"); UserEnterExclusive(); - ptiCurrent = GetW32ThreadInfo(); + ptiCurrent = PsGetCurrentThreadWin32Thread(); if (HookId < WH_MINHOOK || WH_MAXHOOK < HookId ) { @@ -1422,7 +1397,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, _SEH2_TRY { pti->pClientInfo->fsHooks = pti->fsHooks; - pti->pClientInfo->phkCurrent = 0; + pti->pClientInfo->phkCurrent = NULL; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1440,7 +1415,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, _SEH2_TRY { pti->pClientInfo->fsHooks = pti->fsHooks; - pti->pClientInfo->phkCurrent = 0; + pti->pClientInfo->phkCurrent = NULL; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1461,6 +1436,8 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, Hook->ptiHooked = NULL; //gptiCurrent->pDeskInfo->fsHooks |= HOOKID_TO_FLAG(HookId); pti->rpdesk->pDeskInfo->fsHooks |= HOOKID_TO_FLAG(HookId); + pti->sphkCurrent = NULL; + pti->pClientInfo->phkCurrent = NULL; } RtlInitUnicodeString(&Hook->ModuleName, NULL); From c65ab760bf0378c7184eda2200a1999be3a915f5 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 16 Nov 2010 05:30:20 +0000 Subject: [PATCH 024/132] [Win32k|User32] - Cleanup and added debug prints. svn path=/trunk/; revision=49606 --- reactos/dll/win32/user32/windows/hook.c | 7 ++++--- reactos/subsystems/win32/win32k/ntuser/callback.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/user32/windows/hook.c b/reactos/dll/win32/user32/windows/hook.c index c2c8f3efd65..7df8e25ba81 100644 --- a/reactos/dll/win32/user32/windows/hook.c +++ b/reactos/dll/win32/user32/windows/hook.c @@ -451,6 +451,7 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength) { case WH_CBT: { + //ERR("WH_CBT: Code %d\n", Common->Code); switch(Common->Code) { case HCBT_CREATEWND: @@ -461,7 +462,7 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength) CbtCreatewndw.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter; wParam = Common->wParam; lParam = (LPARAM) &CbtCreatewndw; - ERR("HCBT_CREATEWND: hWnd 0x%x Name 0x%x Class 0x%x\n", Common->wParam, Csw.lpszName, Csw.lpszClass); + //ERR("HCBT_CREATEWND: hWnd 0x%x Name 0x%x Class 0x%x\n", Common->wParam, Csw.lpszName, Csw.lpszClass); break; case HCBT_CLICKSKIPPED: pMHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam); @@ -518,13 +519,13 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength) break; } case WH_KEYBOARD_LL: - ERR("WH_KEYBOARD_LL: Code %d, wParam %d\n",Common->Code,Common->wParam); + //ERR("WH_KEYBOARD_LL: Code %d, wParam %d\n",Common->Code,Common->wParam); pKeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam); RtlCopyMemory(&KeyboardLlData, pKeyboardLlData, sizeof(KBDLLHOOKSTRUCT)); Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &KeyboardLlData); break; case WH_MOUSE_LL: - ERR("WH_MOUSE_LL: Code %d, wParam %d\n",Common->Code,Common->wParam); + //ERR("WH_MOUSE_LL: Code %d, wParam %d\n",Common->Code,Common->wParam); pMouseLlData = (PMSLLHOOKSTRUCT)((PCHAR) Common + Common->lParam); RtlCopyMemory(&MouseLlData, pMouseLlData, sizeof(MSLLHOOKSTRUCT)); Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &MouseLlData); diff --git a/reactos/subsystems/win32/win32k/ntuser/callback.c b/reactos/subsystems/win32/win32k/ntuser/callback.c index c395d3a3333..bb087f074f5 100644 --- a/reactos/subsystems/win32/win32k/ntuser/callback.c +++ b/reactos/subsystems/win32/win32k/ntuser/callback.c @@ -352,6 +352,7 @@ co_IntCallHookProc(INT HookId, switch(HookId) { case WH_CBT: + DPRINT("WH_CBT: Code %d\n", Code); switch(Code) { case HCBT_CREATEWND: @@ -524,6 +525,7 @@ co_IntCallHookProc(INT HookId, if (!NT_SUCCESS(Status)) { + DPRINT1("Failure to make Callback! Status 0x%x",Status); goto Fault_Exit; } /* Support write backs... SEH is in UserCallNextHookEx. */ From 83c94373d775b6a6314162589c93d40c11059f2f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 18 Nov 2010 03:14:47 +0000 Subject: [PATCH 025/132] [NTOSKRNL] Fix a bug. svn path=/trunk/; revision=49609 --- reactos/ntoskrnl/ke/i386/thrdini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index b90ae664d96..4f4948cee5b 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -398,7 +398,7 @@ KiSwapContextExit(IN PKTHREAD OldThread, if (!NewThread->SpecialApcDisable) { /* Request APC delivery */ - if (!SwitchFrame->ApcBypassDisable) HalRequestSoftwareInterrupt(APC_LEVEL); + if (SwitchFrame->ApcBypassDisable) HalRequestSoftwareInterrupt(APC_LEVEL); return TRUE; } } From 2b843622b4f9240b4ae5127ccc333f091e33ace3 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Thu, 18 Nov 2010 13:57:21 +0000 Subject: [PATCH 026/132] [win32k] - Some more cleanup svn path=/trunk/; revision=49610 --- .../win32/win32k/include/msgqueue.h | 22 ++++-- .../win32/win32k/ntuser/cursoricon.c | 2 +- .../subsystems/win32/win32k/ntuser/input.c | 22 +++--- .../subsystems/win32/win32k/ntuser/message.c | 26 +++--- .../subsystems/win32/win32k/ntuser/msgqueue.c | 79 ++++++------------- .../subsystems/win32/win32k/ntuser/window.c | 2 +- 6 files changed, 65 insertions(+), 88 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 0c6cc8b7240..435671404df 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -121,13 +121,19 @@ MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, VOID FASTCALL MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode); BOOLEAN APIENTRY -co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, - IN BOOLEAN Hardware, - IN BOOLEAN Remove, - IN PWND Window, - IN UINT MsgFilterLow, - IN UINT MsgFilterHigh, - OUT PMSG Message); +MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOLEAN Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT PMSG Message); +BOOL APIENTRY +co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOL Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT MSG* pMsg); BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue); VOID FASTCALL @@ -196,7 +202,7 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); VOID FASTCALL MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam); VOID FASTCALL -MsqInsertMouseMessage(MSG* Msg); +co_MsqInsertMouseMessage(MSG* Msg); BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove); BOOL FASTCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 37af3f00690..7d25e914fdd 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -217,7 +217,7 @@ BOOL UserSetCursorPos( INT x, INT y, BOOL SendMouseMoveMsg) Msg.wParam = CurInfo->ButtonsDown; Msg.lParam = MAKELPARAM(x, y); Msg.pt = pt; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } /* Store the new cursor position */ diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index e47339cad3a..0c745a2883d 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1156,7 +1156,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[0][SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_LEFTUP) { @@ -1164,7 +1164,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[1][SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) { @@ -1172,7 +1172,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = WM_MBUTTONDOWN; CurInfo->ButtonsDown |= MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP) { @@ -1180,7 +1180,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = WM_MBUTTONUP; CurInfo->ButtonsDown &= ~MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) { @@ -1188,7 +1188,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[0][!SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP) { @@ -1196,7 +1196,7 @@ IntMouseInput(MOUSEINPUT *mi) Msg.message = SwapBtnMsg[1][!SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) && @@ -1214,14 +1214,14 @@ IntMouseInput(MOUSEINPUT *mi) gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } } else if(mi->dwFlags & MOUSEEVENTF_XUP) @@ -1232,21 +1232,21 @@ IntMouseInput(MOUSEINPUT *mi) gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } } if(mi->dwFlags & MOUSEEVENTF_WHEEL) { Msg.message = WM_MOUSEWHEEL; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData); - MsqInsertMouseMessage(&Msg); + co_MsqInsertMouseMessage(&Msg); } return TRUE; diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 4fbdb42f4e9..833e149cb95 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -932,25 +932,23 @@ co_IntPeekMessage( PMSG Msg, } /* Now check for normal messages. */ - if (co_MsqFindMessage( ThreadQueue, - FALSE, - RemoveMessages, - Window, - MsgFilterMin, - MsgFilterMax, - Msg )) + if (MsqPeekMessage( ThreadQueue, + RemoveMessages, + Window, + MsgFilterMin, + MsgFilterMax, + Msg )) { return TRUE; } /* Check for hardware events. */ - if(co_MsqFindMessage( ThreadQueue, - TRUE, - RemoveMessages, - Window, - MsgFilterMin, - MsgFilterMax, - Msg )) + if(co_MsqPeekHardwareMessage( ThreadQueue, + RemoveMessages, + Window, + MsgFilterMin, + MsgFilterMax, + Msg)) { if(!ProcessHardwareMessage(Msg, RemoveMessages)) diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 77d809658d7..d501aa1f5fe 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -97,14 +97,20 @@ IntMsqClearWakeMask(VOID) return TRUE; } +VOID FASTCALL +MsqWakeQueue(PUSER_MESSAGE_QUEUE Queue, DWORD MessageBits) +{ + Queue->QueueBits |= MessageBits; + Queue->ChangedBits |= MessageBits; + if (Queue->WakeMask & MessageBits) + KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE); +} + VOID FASTCALL MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) { Queue->PaintCount++; - Queue->QueueBits |= QS_PAINT; - Queue->ChangedBits |= QS_PAINT; - if (Queue->WakeMask & QS_PAINT) - KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(Queue, QS_PAINT); } VOID FASTCALL @@ -137,7 +143,7 @@ MsqInitializeImpl(VOID) } VOID FASTCALL -MsqInsertMouseMessage(MSG* Msg) +co_MsqInsertMouseMessage(MSG* Msg) { LARGE_INTEGER LargeTickCount; KIRQL OldIrql; @@ -425,17 +431,11 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT /* save the pointer to the WM_MOUSEMOVE message in the new queue */ CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = Message; - CaptureWindow->head.pti->MessageQueue->QueueBits |= QS_MOUSEMOVE; - CaptureWindow->head.pti->MessageQueue->ChangedBits |= QS_MOUSEMOVE; - if (CaptureWindow->head.pti->MessageQueue->WakeMask & QS_MOUSEMOVE) - KeSetEvent(CaptureWindow->head.pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEMOVE); } else { - CaptureWindow->head.pti->MessageQueue->QueueBits |= QS_MOUSEBUTTON; - CaptureWindow->head.pti->MessageQueue->ChangedBits |= QS_MOUSEBUTTON; - if (CaptureWindow->head.pti->MessageQueue->WakeMask & QS_MOUSEBUTTON) - KeSetEvent(CaptureWindow->head.pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEBUTTON); } IntUnLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); @@ -533,9 +533,12 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT } BOOL APIENTRY -co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, - UINT FilterLow, UINT FilterHigh, BOOL Remove, - PMSG Message) +co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOL Remove, + IN PWND Window, + IN UINT FilterLow, + IN UINT FilterHigh, + OUT PMSG Message) { KIRQL OldIrql; POINT ScreenPoint; @@ -852,9 +855,6 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam) UserDereferenceObject(Window); ObDereferenceObject (Thread); - // InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead, - // &Message->ListEntry); - // KeSetEvent(pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } PUSER_MESSAGE FASTCALL @@ -1097,10 +1097,7 @@ MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue, { InsertTailList(&MessageQueue->NotifyMessagesListHead, &NotifyMessage->ListEntry); - MessageQueue->QueueBits |= QS_SENDMESSAGE; - MessageQueue->ChangedBits |= QS_SENDMESSAGE; - if (MessageQueue->WakeMask & QS_SENDMESSAGE) - KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(MessageQueue, QS_SENDMESSAGE); } NTSTATUS FASTCALL @@ -1155,10 +1152,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue, /* queue it in the destination's message queue */ InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry); - MessageQueue->QueueBits |= QS_SENDMESSAGE; - MessageQueue->ChangedBits |= QS_SENDMESSAGE; - if (MessageQueue->WakeMask & QS_SENDMESSAGE) - KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(MessageQueue, QS_SENDMESSAGE); /* we can't access the Message anymore since it could have already been deleted! */ @@ -1308,10 +1302,7 @@ MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN HardwareMessa InsertTailList(&MessageQueue->HardwareMessagesListHead, &Message->ListEntry); } - MessageQueue->QueueBits |= MessageBits; - MessageQueue->ChangedBits |= MessageBits; - if (MessageQueue->WakeMask & MessageBits) - KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(MessageQueue, MessageBits); } VOID FASTCALL @@ -1319,15 +1310,11 @@ MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode) { MessageQueue->QuitPosted = TRUE; MessageQueue->QuitExitCode = ExitCode; - MessageQueue->QueueBits |= QS_POSTMESSAGE; - MessageQueue->ChangedBits |= QS_POSTMESSAGE; - if (MessageQueue->WakeMask & QS_POSTMESSAGE) - KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(MessageQueue, QS_POSTMESSAGE); } BOOLEAN APIENTRY -co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, - IN BOOLEAN Hardware, +MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN BOOLEAN Remove, IN PWND Window, IN UINT MsgFilterLow, @@ -1337,17 +1324,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, PLIST_ENTRY CurrentEntry; PUSER_MESSAGE CurrentMessage; PLIST_ENTRY ListHead; - - if (Hardware) - { - return(co_MsqPeekHardwareMessage( MessageQueue, - Window, - MsgFilterLow, - MsgFilterHigh, - Remove, - Message)); - } - + CurrentEntry = MessageQueue->PostedMessagesListHead.Flink; ListHead = &MessageQueue->PostedMessagesListHead; while (CurrentEntry != ListHead) @@ -1361,15 +1338,11 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, ( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) ) { - if (Remove) - { - RemoveEntryList(&CurrentMessage->ListEntry); - } - *Message= CurrentMessage->Msg; if (Remove) { + RemoveEntryList(&CurrentMessage->ListEntry); MsqDestroyMessage(CurrentMessage); } diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 046515ce454..00bfa3ad25c 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -2567,7 +2567,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window) msg.wParam = IntGetSysCursorInfo()->ButtonsDown; msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y); msg.pt = gpsi->ptCursor; - MsqInsertMouseMessage(&msg); + co_MsqInsertMouseMessage(&msg); if (!IntIsWindow(Window->head.h)) { From 7b2f0a799abcbad5c2eb194b4ac58daf060b1a8f Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 18 Nov 2010 16:17:59 +0000 Subject: [PATCH 027/132] [Win32k] - Test for hooks before setting up for a hook call. This eliminates overhead. svn path=/trunk/; revision=49612 --- .../subsystems/win32/win32k/ntuser/window.c | 170 +++++++++--------- 1 file changed, 82 insertions(+), 88 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 00bfa3ad25c..439c4366571 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -15,7 +15,6 @@ #define NDEBUG #include - /* dialog resources appear to pass this in 16 bits, handle them properly */ #define CW_USEDEFAULT16 (0x8000) @@ -402,6 +401,9 @@ static LRESULT co_UserFreeWindow(PWND Window, DestroyTimersForWindow(ThreadData, Window); + /* Unregister hot keys */ + UnregisterWindowHotKeys (Window); + /* flush the message queue */ MsqRemoveWindowMessagesFromQueue(Window); @@ -421,9 +423,6 @@ static LRESULT co_UserFreeWindow(PWND Window, ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL; } - /* Unregister hot keys */ - UnregisterWindowHotKeys (Window); - /* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */ #if 0 /* FIXME */ @@ -1909,7 +1908,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, USER_REFERENCE_ENTRY ParentRef, Ref; PTHREADINFO pti; DWORD dwShowMode = SW_SHOW; - CREATESTRUCTW *pCsw; + CREATESTRUCTW *pCsw = NULL; PVOID pszClass = NULL, pszName = NULL; DECLARE_RETURN(PWND); @@ -1983,100 +1982,94 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, } hWnd = UserHMGetHandle(Window); + hwndInsertAfter = HWND_TOP; UserRefObjectCo(Window, &Ref); ObDereferenceObject(WinSta); - //// Call the WH_CBT hook //// + dwStyle = Window->style; - // Allocate the calling structures Justin Case this goes Global. - pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK); - pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK); - - /* Fill the new CREATESTRUCTW */ - pCsw->lpCreateParams = Cs->lpCreateParams; - pCsw->hInstance = Cs->hInstance; - pCsw->hMenu = Cs->hMenu; - pCsw->hwndParent = Cs->hwndParent; - pCsw->cx = Cs->cx; - pCsw->cy = Cs->cy; - pCsw->x = Cs->x; - pCsw->y = Cs->y; - pCsw->dwExStyle = Cs->dwExStyle; - dwStyle = Cs->style; // Save it anyway. - pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */ - pCsw->lpszName = Cs->lpszName; - pCsw->lpszClass = Cs->lpszClass; - - // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes. - if (!IS_ATOM(ClassName->Buffer)) + //// Check for a hook to eliminate overhead. //// + if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) ) { - if (Window->state & WNDS_ANSICREATOR) - { - ANSI_STRING AnsiString; - AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR); - pszClass = UserHeapAlloc(AnsiString.MaximumLength); - RtlZeroMemory(pszClass, AnsiString.MaximumLength); - AnsiString.Buffer = (PCHAR)pszClass; - RtlUnicodeStringToAnsiString(&AnsiString, ClassName, FALSE); - } - else - { - UNICODE_STRING UnicodeString; - UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL); - pszClass = UserHeapAlloc(UnicodeString.MaximumLength); - RtlZeroMemory(pszClass, UnicodeString.MaximumLength); - UnicodeString.Buffer = (PWSTR)pszClass; - RtlCopyUnicodeString(&UnicodeString, ClassName); - } - if (pszClass) pCsw->lpszClass = UserHeapAddressToUser(pszClass); - } - if (WindowName->Length) - { - UNICODE_STRING Name; - Name.Buffer = WindowName->Buffer; - Name.Length = WindowName->Length; - Name.MaximumLength = WindowName->MaximumLength; + // Allocate the calling structures Justin Case this goes Global. + pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK); + pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK); - if (Window->state & WNDS_ANSICREATOR) - { - ANSI_STRING AnsiString; - AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(&Name)+sizeof(CHAR); - pszName = UserHeapAlloc(AnsiString.MaximumLength); - RtlZeroMemory(pszName, AnsiString.MaximumLength); - AnsiString.Buffer = (PCHAR)pszName; - RtlUnicodeStringToAnsiString(&AnsiString, &Name, FALSE); - } - else - { - UNICODE_STRING UnicodeString; - UnicodeString.MaximumLength = Name.Length + sizeof(UNICODE_NULL); - pszName = UserHeapAlloc(UnicodeString.MaximumLength); - RtlZeroMemory(pszName, UnicodeString.MaximumLength); - UnicodeString.Buffer = (PWSTR)pszName; - RtlCopyUnicodeString(&UnicodeString, &Name); - } - if (pszName) pCsw->lpszName = UserHeapAddressToUser(pszName); - } + /* Fill the new CREATESTRUCTW */ + RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW)); + pCsw->style = dwStyle; /* HCBT_CREATEWND needs the real window style */ - pCbtCreate->lpcs = pCsw; - pCbtCreate->hwndInsertAfter = HWND_TOP; + // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes. + if (!IS_ATOM(ClassName->Buffer)) + { + if (Window->state & WNDS_ANSICREATOR) + { + ANSI_STRING AnsiString; + AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR); + pszClass = UserHeapAlloc(AnsiString.MaximumLength); + RtlZeroMemory(pszClass, AnsiString.MaximumLength); + AnsiString.Buffer = (PCHAR)pszClass; + RtlUnicodeStringToAnsiString(&AnsiString, ClassName, FALSE); + } + else + { + UNICODE_STRING UnicodeString; + UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL); + pszClass = UserHeapAlloc(UnicodeString.MaximumLength); + RtlZeroMemory(pszClass, UnicodeString.MaximumLength); + UnicodeString.Buffer = (PWSTR)pszClass; + RtlCopyUnicodeString(&UnicodeString, ClassName); + } + if (pszClass) pCsw->lpszClass = UserHeapAddressToUser(pszClass); + } + if (WindowName->Length) + { + UNICODE_STRING Name; + Name.Buffer = WindowName->Buffer; + Name.Length = WindowName->Length; + Name.MaximumLength = WindowName->MaximumLength; - Result = co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) pCbtCreate); - if (Result != 0) - { - DPRINT1("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result); - RETURN( (PWND) NULL); + if (Window->state & WNDS_ANSICREATOR) + { + ANSI_STRING AnsiString; + AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(&Name)+sizeof(CHAR); + pszName = UserHeapAlloc(AnsiString.MaximumLength); + RtlZeroMemory(pszName, AnsiString.MaximumLength); + AnsiString.Buffer = (PCHAR)pszName; + RtlUnicodeStringToAnsiString(&AnsiString, &Name, FALSE); + } + else + { + UNICODE_STRING UnicodeString; + UnicodeString.MaximumLength = Name.Length + sizeof(UNICODE_NULL); + pszName = UserHeapAlloc(UnicodeString.MaximumLength); + RtlZeroMemory(pszName, UnicodeString.MaximumLength); + UnicodeString.Buffer = (PWSTR)pszName; + RtlCopyUnicodeString(&UnicodeString, &Name); + } + if (pszName) pCsw->lpszName = UserHeapAddressToUser(pszName); + } + + pCbtCreate->lpcs = pCsw; + pCbtCreate->hwndInsertAfter = hwndInsertAfter; + + //// Call the WH_CBT hook //// + Result = co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) pCbtCreate); + if (Result != 0) + { + DPRINT1("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result); + RETURN( (PWND) NULL); + } + // Write back changes. + Cs->cx = pCsw->cx; + Cs->cy = pCsw->cy; + Cs->x = pCsw->x; + Cs->y = pCsw->y; + hwndInsertAfter = pCbtCreate->hwndInsertAfter; } - // Write back changes. - Cs->cx = pCsw->cx; - Cs->cy = pCsw->cy; - Cs->x = pCsw->x; - Cs->y = pCsw->y; - hwndInsertAfter = pCbtCreate->hwndInsertAfter; /* NCCREATE and WM_NCCALCSIZE need the original values */ - Cs->style = dwStyle; Cs->lpszName = (LPCWSTR) WindowName; Cs->lpszClass = (LPCWSTR) ClassName; @@ -2115,7 +2108,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) IntLinkHwnd(Window, HWND_BOTTOM); else - IntLinkHwnd(Window, HWND_TOP); + IntLinkHwnd(Window, hwndInsertAfter); } /* Send the NCCREATE message */ @@ -2219,6 +2212,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, CLEANUP: if (!_ret_) { + DPRINT("co_UserCreateWindowEx(): Error Created window!\n"); /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */ if (Window) co_UserDestroyWindow(Window); From 4886d14bab03ad479cc861ac131af4416ca1ac4a Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 18 Nov 2010 16:26:54 +0000 Subject: [PATCH 028/132] [Win32k] - Fix style, use client style. svn path=/trunk/; revision=49613 --- reactos/subsystems/win32/win32k/ntuser/window.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 439c4366571..7cab141bf0e 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -1898,7 +1898,6 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, { PWND Window = NULL, ParentWindow = NULL, OwnerWindow; HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter; - DWORD dwStyle; PWINSTATION_OBJECT WinSta; PCLS Class = NULL; SIZE Size; @@ -1987,8 +1986,6 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, UserRefObjectCo(Window, &Ref); ObDereferenceObject(WinSta); - dwStyle = Window->style; - //// Check for a hook to eliminate overhead. //// if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) ) { @@ -1998,7 +1995,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, /* Fill the new CREATESTRUCTW */ RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW)); - pCsw->style = dwStyle; /* HCBT_CREATEWND needs the real window style */ + pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */ // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes. if (!IS_ATOM(ClassName->Buffer)) @@ -2077,7 +2074,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, Size.cx = Cs->cx; Size.cy = Cs->cy; - if ((dwStyle & WS_THICKFRAME) || !(dwStyle & (WS_POPUP | WS_CHILD))) + if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD))) { POINT MaxSize, MaxPos, MinTrack, MaxTrack; @@ -2105,7 +2102,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, if (NULL != ParentWindow) { /* link the window into the siblings list */ - if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) + if ((Cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) IntLinkHwnd(Window, HWND_BOTTOM); else IntLinkHwnd(Window, hwndInsertAfter); From 5ba58aa606c9fa0848ae200c06299cefce4deedf Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 18 Nov 2010 19:20:38 +0000 Subject: [PATCH 029/132] [NTOSKRNL] - Initialize the Zero variable - Don't corrupt the Color value in case we didn't have any page on MmZeroedPageListHead. - Fixes boot. svn path=/trunk/; revision=49614 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 9c2f5bdbe18..575c179a33d 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -407,7 +407,7 @@ MiRemoveZeroPage(IN ULONG Color) { PFN_NUMBER PageIndex; PMMPFN Pfn1; - BOOLEAN Zero; + BOOLEAN Zero = FALSE; /* Make sure PFN lock is held and we have pages */ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); @@ -421,7 +421,6 @@ MiRemoveZeroPage(IN ULONG Color) /* Check the zero list */ ASSERT_LIST_INVARIANT(&MmZeroedPageListHead); PageIndex = MmZeroedPageListHead.Flink; - Color = PageIndex & MmSecondaryColorMask; if (PageIndex == LIST_HEAD) { /* This means there's no zero pages, we have to look for free ones */ @@ -444,6 +443,10 @@ MiRemoveZeroPage(IN ULONG Color) } } } + else + { + Color = PageIndex & MmSecondaryColorMask; + } } /* Sanity checks */ From d4577f8b7f91481bfdd092df76656de19aa3e098 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 19 Nov 2010 06:28:20 +0000 Subject: [PATCH 030/132] [FORMATTING] No code change svn path=/trunk/; revision=49616 --- reactos/ntoskrnl/ke/i386/thrdini.c | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index 4f4948cee5b..fb2447d16de 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -65,7 +65,7 @@ KiThreadStartup(VOID) PKTRAP_FRAME TrapFrame; PKSTART_FRAME StartFrame; PKUINIT_FRAME InitFrame; - + /* Get the start and trap frames */ InitFrame = KeGetCurrentThread()->KernelStack; StartFrame = &InitFrame->StartFrame; @@ -73,13 +73,13 @@ KiThreadStartup(VOID) /* Lower to APC level */ KfLowerIrql(APC_LEVEL); - + /* Call the system routine */ StartFrame->SystemRoutine(StartFrame->StartRoutine, StartFrame->StartContext); - + /* If we returned, we better be a user thread */ if (!StartFrame->UserThread) DbgBreakPoint(); - + /* Exit to user-mode */ KiServiceExit2(TrapFrame); } @@ -275,7 +275,7 @@ KiIdleLoop(VOID) YieldProcessor(); YieldProcessor(); _disable(); - + /* Now loop forever */ while (TRUE) { @@ -286,31 +286,31 @@ KiIdleLoop(VOID) { /* Quiesce the DPC software interrupt */ HalClearSoftwareInterrupt(DISPATCH_LEVEL); - + /* Handle it */ KiRetireDpcList(Prcb); } - + /* Check if a new thread is scheduled for execution */ if (Prcb->NextThread) { /* Enable interupts */ _enable(); - + /* Capture current thread data */ OldThread = Prcb->CurrentThread; NewThread = Prcb->NextThread; - + /* Set new thread data */ Prcb->NextThread = NULL; Prcb->CurrentThread = NewThread; - + /* The thread is now running */ NewThread->State = Running; - + /* Switch away from the idle thread */ KiSwapContext(APC_LEVEL, OldThread); - + /* We are back in the idle thread -- disable interrupts again */ _enable(); YieldProcessor(); @@ -335,7 +335,7 @@ KiSwapContextExit(IN PKTHREAD OldThread, PKGDTENTRY GdtEntry; PKTHREAD NewThread; PKUINIT_FRAME InitFrame; - + /* We are on the new thread stack now */ NewThread = Pcr->PrcbData.CurrentThread; @@ -354,17 +354,17 @@ KiSwapContextExit(IN PKTHREAD OldThread, /* Switch address space and flush TLB */ __writecr3(NewProcess->DirectoryTableBase[0]); } - + /* Clear GS */ Ke386SetGs(0); - + /* Set the TEB */ Pcr->NtTib.Self = (PVOID)NewThread->Teb; GdtEntry = &Pcr->GDT[KGDT_R3_TEB / sizeof(KGDTENTRY)]; GdtEntry->BaseLow = (USHORT)((ULONG_PTR)NewThread->Teb & 0xFFFF); GdtEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)NewThread->Teb >> 16); GdtEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)NewThread->Teb >> 24); - + /* Set new TSS fields */ InitFrame = (PKUINIT_FRAME)NewThread->InitialStack - 1; Pcr->TSS->Esp0 = (ULONG_PTR)&InitFrame->TrapFrame; @@ -373,7 +373,7 @@ KiSwapContextExit(IN PKTHREAD OldThread, Pcr->TSS->Esp0 -= (FIELD_OFFSET(KTRAP_FRAME, V86Gs) - FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs)); } Pcr->TSS->IoMapBase = NewProcess->IopmOffset; - + /* Increase thread context switches */ NewThread->ContextSwitches++; @@ -390,7 +390,7 @@ KiSwapContextExit(IN PKTHREAD OldThread, (ULONG_PTR)OldThread->InitialStack, 0); } - + /* Kernel APCs may be pending */ if (NewThread->ApcState.KernelApcPending) { @@ -402,7 +402,7 @@ KiSwapContextExit(IN PKTHREAD OldThread, return TRUE; } } - + /* Return */ return FALSE; } @@ -432,13 +432,13 @@ KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, /* Get thread pointers */ OldThread = (PKTHREAD)(OldThreadAndApcFlag & ~3); NewThread = Pcr->PrcbData.CurrentThread; - + /* Get the old thread and set its kernel stack */ OldThread->KernelStack = SwitchFrame; /* ISRs can change FPU state, so disable interrupts while checking */ _disable(); - + /* Get current and new CR0 and check if they've changed */ Cr0 = __readcr0(); NewCr0 = NewThread->NpxState | @@ -459,10 +459,10 @@ KiDispatchInterrupt(VOID) PKPRCB Prcb = &Pcr->PrcbData; PVOID OldHandler; PKTHREAD NewThread, OldThread; - + /* Disable interrupts */ _disable(); - + /* Check for pending timers, pending DPCs, or pending ready threads */ if ((Prcb->DpcData[0].DpcQueueDepth) || (Prcb->TimerRequest) || @@ -471,17 +471,17 @@ KiDispatchInterrupt(VOID) /* Switch to safe execution context */ OldHandler = Pcr->NtTib.ExceptionList; Pcr->NtTib.ExceptionList = EXCEPTION_CHAIN_END; - + /* Retire DPCs while under the DPC stack */ KiRetireDpcListInDpcStack(Prcb, Prcb->DpcStack); - + /* Restore context */ Pcr->NtTib.ExceptionList = OldHandler; } - + /* Re-enable interrupts */ _enable(); - + /* Check for quantum end */ if (Prcb->QuantumEnd) { @@ -494,18 +494,18 @@ KiDispatchInterrupt(VOID) /* Capture current thread data */ OldThread = Prcb->CurrentThread; NewThread = Prcb->NextThread; - + /* Set new thread data */ Prcb->NextThread = NULL; Prcb->CurrentThread = NewThread; - + /* The thread is now running */ NewThread->State = Running; OldThread->WaitReason = WrDispatchInt; - + /* Make the old thread ready */ KxQueueReadyThread(OldThread, Prcb); - + /* Swap to the new thread */ KiSwapContext(APC_LEVEL, OldThread); } From ae495fcf68b7305910fc7224173b292552a81e5e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 19 Nov 2010 06:34:14 +0000 Subject: [PATCH 031/132] [NTOSKRNL] Use appropriated macros svn path=/trunk/; revision=49617 --- reactos/ntoskrnl/ke/i386/kiinit.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/kiinit.c b/reactos/ntoskrnl/ke/i386/kiinit.c index 535d6d27164..45b25ed7ec6 100644 --- a/reactos/ntoskrnl/ke/i386/kiinit.c +++ b/reactos/ntoskrnl/ke/i386/kiinit.c @@ -264,19 +264,14 @@ KiInitMachineDependent(VOID) if (KeFeatureBits & KF_FXSR) { /* Get the current thread NPX state */ - FxSaveArea = (PVOID) - ((ULONG_PTR)KeGetCurrentThread()->InitialStack - - NPX_FRAME_LENGTH); + FxSaveArea = KiGetThreadNpxArea(KeGetCurrentThread()); /* Clear initial MXCsr mask */ FxSaveArea->U.FxArea.MXCsrMask = 0; /* Save the current NPX State */ -#ifdef __GNUC__ - asm volatile("fxsave %0\n\t" : "=m" (*FxSaveArea)); -#else - __asm fxsave [FxSaveArea] -#endif + Ke386SaveFpuState(FxSaveArea); + /* Check if the current mask doesn't match the reserved bits */ if (FxSaveArea->U.FxArea.MXCsrMask != 0) { From 752c855c83bb6e69cc2ee376f51bf66cea65e442 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 19 Nov 2010 06:46:59 +0000 Subject: [PATCH 032/132] [NTOSKRNL] Simplify code, which should bring some fixing svn path=/trunk/; revision=49618 --- reactos/ntoskrnl/ke/i386/thrdini.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/thrdini.c b/reactos/ntoskrnl/ke/i386/thrdini.c index fb2447d16de..07da5ab1fa3 100644 --- a/reactos/ntoskrnl/ke/i386/thrdini.c +++ b/reactos/ntoskrnl/ke/i386/thrdini.c @@ -334,7 +334,6 @@ KiSwapContextExit(IN PKTHREAD OldThread, PKPROCESS OldProcess, NewProcess; PKGDTENTRY GdtEntry; PKTHREAD NewThread; - PKUINIT_FRAME InitFrame; /* We are on the new thread stack now */ NewThread = Pcr->PrcbData.CurrentThread; @@ -366,12 +365,12 @@ KiSwapContextExit(IN PKTHREAD OldThread, GdtEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)NewThread->Teb >> 24); /* Set new TSS fields */ - InitFrame = (PKUINIT_FRAME)NewThread->InitialStack - 1; - Pcr->TSS->Esp0 = (ULONG_PTR)&InitFrame->TrapFrame; - if (!(InitFrame->TrapFrame.EFlags & EFLAGS_V86_MASK)) + Pcr->TSS->Esp0 = (ULONG_PTR)NewThread->InitialStack; + if (!((KeGetTrapFrame(NewThread))->EFlags & EFLAGS_V86_MASK)) { Pcr->TSS->Esp0 -= (FIELD_OFFSET(KTRAP_FRAME, V86Gs) - FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs)); } + Pcr->TSS->Esp0 -= NPX_FRAME_LENGTH; Pcr->TSS->IoMapBase = NewProcess->IopmOffset; /* Increase thread context switches */ @@ -443,7 +442,7 @@ KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, Cr0 = __readcr0(); NewCr0 = NewThread->NpxState | (Cr0 & ~(CR0_MP | CR0_EM | CR0_TS)) | - ((PKUINIT_FRAME)NewThread->InitialStack - 1)->FxSaveArea.Cr0NpxState; + KiGetThreadNpxArea(NewThread)->Cr0NpxState; if (Cr0 != NewCr0) __writecr0(NewCr0); /* Now enable interrupts and do the switch */ From 4e31a0e529d47115d79c6e1e2b32ecb0e016235a Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Fri, 19 Nov 2010 15:21:38 +0000 Subject: [PATCH 033/132] - Sync atl, hlink, shdocvw, wtsapi32 with Wine 1.3.7 svn path=/trunk/; revision=49631 --- reactos/dll/win32/atl/atl.rgs | 4 +- reactos/dll/win32/atl/atl_ax.c | 3 + reactos/dll/win32/atl/atliface.idl | 4 +- reactos/dll/win32/atl/registrar.c | 17 +- reactos/dll/win32/hlink/hlink.spec | 2 +- reactos/dll/win32/hlink/hlink_main.c | 65 +++ reactos/dll/win32/hlink/link.c | 106 +++-- reactos/dll/win32/shdocvw/De.rc | 88 ++++ reactos/dll/win32/shdocvw/En.rc | 29 ++ reactos/dll/win32/shdocvw/Es.rc | 89 ++++ reactos/dll/win32/shdocvw/Fr.rc | 91 +++++ reactos/dll/win32/shdocvw/He.rc | 90 ++++ reactos/dll/win32/shdocvw/It.rc | 90 ++++ reactos/dll/win32/shdocvw/Ko.rc | 88 ++++ reactos/dll/win32/shdocvw/Lt.rc | 89 ++++ reactos/dll/win32/shdocvw/Nl.rc | 86 ++++ reactos/dll/win32/shdocvw/Pl.rc | 87 ++++ reactos/dll/win32/shdocvw/Pt.rc | 94 +++++ reactos/dll/win32/shdocvw/Ro.rc | 60 +++ reactos/dll/win32/shdocvw/Si.rc | 88 ++++ reactos/dll/win32/shdocvw/Sr.rc | 156 +++++++ reactos/dll/win32/shdocvw/Sv.rc | 88 ++++ reactos/dll/win32/shdocvw/Uk.rc | 90 ++++ reactos/dll/win32/shdocvw/dochost.c | 16 +- reactos/dll/win32/shdocvw/frame.c | 7 +- reactos/dll/win32/shdocvw/ie.c | 18 +- reactos/dll/win32/shdocvw/ietoolbar.bmp | Bin 0 -> 24698 bytes reactos/dll/win32/shdocvw/ietoolbar.svg | 285 +++++++++++++ reactos/dll/win32/shdocvw/iexplore.c | 497 ++++++++++++++++++++++- reactos/dll/win32/shdocvw/intshcut.c | 129 +++++- reactos/dll/win32/shdocvw/navigate.c | 96 +++-- reactos/dll/win32/shdocvw/resource.h | 24 ++ reactos/dll/win32/shdocvw/shdocvw.h | 41 +- reactos/dll/win32/shdocvw/shdocvw.rbuild | 1 + reactos/dll/win32/shdocvw/shdocvw.rc | 18 + reactos/dll/win32/shdocvw/shdocvw.spec | 2 +- reactos/dll/win32/shdocvw/shdocvw_main.c | 40 +- reactos/dll/win32/shdocvw/webbrowser.c | 78 +++- reactos/dll/win32/wtsapi32/wtsapi32.c | 10 + reactos/dll/win32/wtsapi32/wtsapi32.spec | 2 +- 40 files changed, 2729 insertions(+), 139 deletions(-) create mode 100644 reactos/dll/win32/shdocvw/De.rc create mode 100644 reactos/dll/win32/shdocvw/Es.rc create mode 100644 reactos/dll/win32/shdocvw/Fr.rc create mode 100644 reactos/dll/win32/shdocvw/He.rc create mode 100644 reactos/dll/win32/shdocvw/It.rc create mode 100644 reactos/dll/win32/shdocvw/Ko.rc create mode 100644 reactos/dll/win32/shdocvw/Lt.rc create mode 100644 reactos/dll/win32/shdocvw/Nl.rc create mode 100644 reactos/dll/win32/shdocvw/Pl.rc create mode 100644 reactos/dll/win32/shdocvw/Pt.rc create mode 100644 reactos/dll/win32/shdocvw/Ro.rc create mode 100644 reactos/dll/win32/shdocvw/Si.rc create mode 100644 reactos/dll/win32/shdocvw/Sr.rc create mode 100644 reactos/dll/win32/shdocvw/Sv.rc create mode 100644 reactos/dll/win32/shdocvw/Uk.rc create mode 100644 reactos/dll/win32/shdocvw/ietoolbar.bmp create mode 100644 reactos/dll/win32/shdocvw/ietoolbar.svg diff --git a/reactos/dll/win32/atl/atl.rgs b/reactos/dll/win32/atl/atl.rgs index 8b1d476b20d..ee432497f78 100644 --- a/reactos/dll/win32/atl/atl.rgs +++ b/reactos/dll/win32/atl/atl.rgs @@ -2,10 +2,10 @@ HKCR { ATL.Registrar = s 'Registrar Class' { - CLSID = s '%CLSID_ATLRegistrar%' + CLSID = s '%CLSID_Registrar%' } NoRemove CLSID { - ForceRemove '%CLSID_ATLRegistrar%' = s 'Registrar Class' + ForceRemove '%CLSID_Registrar%' = s 'Registrar Class' { ProgID = s 'ATL.Registrar' InprocServer32 = s '%MODULE%' diff --git a/reactos/dll/win32/atl/atl_ax.c b/reactos/dll/win32/atl/atl_ax.c index d9d60a56b9e..1293cb830ba 100644 --- a/reactos/dll/win32/atl/atl_ax.c +++ b/reactos/dll/win32/atl/atl_ax.c @@ -1053,6 +1053,9 @@ HRESULT WINAPI AtlAxAttachControl(IUnknown* pControl, HWND hWnd, IUnknown** ppUn *ppUnkContainer = (IUnknown*) pUnkContainer; } + if(!hWnd) + return S_FALSE; + return hr; } diff --git a/reactos/dll/win32/atl/atliface.idl b/reactos/dll/win32/atl/atliface.idl index ef3e5e58165..887338fdb50 100644 --- a/reactos/dll/win32/atl/atliface.idl +++ b/reactos/dll/win32/atl/atliface.idl @@ -19,7 +19,7 @@ import "ocidl.idl"; cpp_quote("#ifdef ATL_INITGUID") -cpp_quote("#include \"initguid.h\"") +cpp_quote("#include ") cpp_quote("#endif") [ @@ -68,7 +68,7 @@ interface IRegistrar : IUnknown [in] LPCOLESTR szType); } -cpp_quote("DEFINE_GUID(CLSID_ATLRegistrar,0x44ec053a,0x400f,0x11d0,0x9d,0xcd,0x00,0xa0,0xc9,0x03,0x91,0xd3);") +cpp_quote("DEFINE_GUID(CLSID_Registrar,0x44ec053a,0x400f,0x11d0,0x9d,0xcd,0x00,0xa0,0xc9,0x03,0x91,0xd3);") cpp_quote("HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);") cpp_quote("HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);") diff --git a/reactos/dll/win32/atl/registrar.c b/reactos/dll/win32/atl/registrar.c index 7076e35c17c..c9d7e6c7af7 100644 --- a/reactos/dll/win32/atl/registrar.c +++ b/reactos/dll/win32/atl/registrar.c @@ -687,8 +687,9 @@ static HRESULT WINAPI RegistrarCF_QueryInterface(IClassFactory *iface, REFIID ri { TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); - if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) { + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) { *ppvObject = iface; + IClassFactory_AddRef( iface ); return S_OK; } @@ -743,10 +744,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObject) { TRACE("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppvObject); - if(IsEqualGUID(&CLSID_ATLRegistrar, clsid)) { - *ppvObject = &RegistrarCF; - return S_OK; - } + if(IsEqualGUID(&CLSID_Registrar, clsid)) + return IClassFactory_QueryInterface( &RegistrarCF, riid, ppvObject ); FIXME("Not supported class %s\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE; @@ -787,14 +786,14 @@ static HRESULT do_register_dll_server(IRegistrar *pRegistrar, LPCOLESTR wszDll, static HRESULT do_register_server(BOOL do_register) { - static const WCHAR CLSID_ATLRegistrarW[] = - {'C','L','S','I','D','_','A','T','L','R','e','g','i','s','t','r','a','r',0}; + static const WCHAR CLSID_RegistrarW[] = + {'C','L','S','I','D','_','R','e','g','i','s','t','r','a','r',0}; static const WCHAR atl_dllW[] = {'a','t','l','.','d','l','l',0}; WCHAR clsid_str[40]; - const struct _ATL_REGMAP_ENTRY reg_map[] = {{CLSID_ATLRegistrarW, clsid_str}, {NULL,NULL}}; + const struct _ATL_REGMAP_ENTRY reg_map[] = {{CLSID_RegistrarW, clsid_str}, {NULL,NULL}}; - StringFromGUID2(&CLSID_ATLRegistrar, clsid_str, sizeof(clsid_str)/sizeof(WCHAR)); + StringFromGUID2(&CLSID_Registrar, clsid_str, sizeof(clsid_str)/sizeof(WCHAR)); return do_register_dll_server(NULL, atl_dllW, MAKEINTRESOURCEW(101), do_register, reg_map); } diff --git a/reactos/dll/win32/hlink/hlink.spec b/reactos/dll/win32/hlink/hlink.spec index 0cc761fbcb6..ca8144e7d76 100644 --- a/reactos/dll/win32/hlink/hlink.spec +++ b/reactos/dll/win32/hlink/hlink.spec @@ -2,7 +2,7 @@ 4 stdcall HlinkCreateFromString(wstr wstr wstr ptr long ptr ptr ptr) 5 stdcall HlinkCreateFromData(ptr ptr long ptr ptr ptr) 6 stdcall HlinkCreateBrowseContext(ptr ptr ptr) -7 stub HlinkClone +7 stdcall HlinkClone(ptr ptr ptr long ptr) 8 stdcall HlinkNavigateToStringReference(wstr wstr ptr long ptr long ptr ptr ptr) 9 stdcall HlinkOnNavigate(ptr ptr long ptr wstr wstr ptr) 10 stdcall HlinkNavigate(ptr ptr long ptr ptr ptr) diff --git a/reactos/dll/win32/hlink/hlink_main.c b/reactos/dll/win32/hlink/hlink_main.c index e96f206645f..cda96836484 100644 --- a/reactos/dll/win32/hlink/hlink_main.c +++ b/reactos/dll/win32/hlink/hlink_main.c @@ -428,6 +428,71 @@ HRESULT WINAPI HlinkResolveMonikerForData(LPMONIKER pimkReference, DWORD reserve return IMoniker_BindToStorage(pimkReference, pibc, NULL, &IID_IUnknown, &obj); } +/*********************************************************************** + * HlinkClone (HLINK.@) + */ +HRESULT WINAPI HlinkClone(IHlink *hlink, REFIID riid, IHlinkSite *hls, + DWORD site_data, void **obj) +{ + IMoniker *mk, *clone_mk = NULL; + WCHAR *loc, *name = NULL; + HRESULT hres; + + if(!hlink || !riid || !obj) + return E_INVALIDARG; + + *obj = NULL; + + hres = IHlink_GetMonikerReference(hlink, HLINKGETREF_DEFAULT, &mk, &loc); + if(FAILED(hres)) + return hres; + + if(mk) { + IStream *strm; + LARGE_INTEGER lgint; + + hres = CreateStreamOnHGlobal(NULL, TRUE, &strm); + if(FAILED(hres)) { + IMoniker_Release(mk); + goto cleanup; + } + + hres = OleSaveToStream((IPersistStream*)mk, strm); + if(FAILED(hres)) { + IStream_Release(strm); + IMoniker_Release(mk); + goto cleanup; + } + IMoniker_Release(mk); + + lgint.QuadPart = 0; + hres = IStream_Seek(strm, lgint, STREAM_SEEK_SET, NULL); + if(FAILED(hres)) { + IStream_Release(strm); + goto cleanup; + } + + hres = OleLoadFromStream(strm, &IID_IMoniker, (void**)&clone_mk); + IStream_Release(strm); + if(FAILED(hres)) + goto cleanup; + } + + hres = IHlink_GetFriendlyName(hlink, HLFNAMEF_DEFAULT, &name); + if(FAILED(hres)) + goto cleanup; + + hres = HlinkCreateFromMoniker(clone_mk, loc, name, hls, site_data, NULL, + &IID_IHlink, obj); + +cleanup: + if(clone_mk) + IMoniker_Release(clone_mk); + CoTaskMemFree(loc); + CoTaskMemFree(name); + return hres; +} + static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) { diff --git a/reactos/dll/win32/hlink/link.c b/reactos/dll/win32/hlink/link.c index ffd3cda854b..b0d99aaf4e9 100644 --- a/reactos/dll/win32/hlink/link.c +++ b/reactos/dll/win32/hlink/link.c @@ -69,20 +69,40 @@ static inline HlinkImpl* HlinkImpl_from_IDataObject( IDataObject* iface) return (HlinkImpl*) ((CHAR*)iface - FIELD_OFFSET(HlinkImpl, lpDOVtbl)); } -static inline void __GetMoniker(HlinkImpl* This, IMoniker** moniker) +static HRESULT __GetMoniker(HlinkImpl* This, IMoniker** moniker, + DWORD ref_type) { - *moniker = NULL; - if (This->Moniker) + HRESULT hres; + + if (ref_type == HLINKGETREF_DEFAULT) + ref_type = HLINKGETREF_RELATIVE; + + if (ref_type == HLINKGETREF_ABSOLUTE && This->Site) { - *moniker = This->Moniker; - if (*moniker) - IMoniker_AddRef(*moniker); - } - else if (This->Site) - { - IHlinkSite_GetMoniker(This->Site, This->SiteData, - OLEGETMONIKER_FORCEASSIGN, OLEWHICHMK_CONTAINER, moniker); + IMoniker *hls_moniker; + + hres = IHlinkSite_GetMoniker(This->Site, This->SiteData, + OLEGETMONIKER_FORCEASSIGN, OLEWHICHMK_CONTAINER, &hls_moniker); + if (FAILED(hres)) + return hres; + + if (This->Moniker) + { + hres = IMoniker_ComposeWith(hls_moniker, This->Moniker, FALSE, + moniker); + IMoniker_Release(hls_moniker); + return hres; + } + + *moniker = hls_moniker; + return S_OK; } + + *moniker = This->Moniker; + if (*moniker) + IMoniker_AddRef(*moniker); + + return S_OK; } HRESULT WINAPI HLink_Constructor(IUnknown *pUnkOuter, REFIID riid, @@ -191,10 +211,11 @@ static HRESULT WINAPI IHlink_fnGetHlinkSite( IHlink* iface, TRACE("(%p)->(%p %p)\n", This, ppihlSite, pdwSiteData); *ppihlSite = This->Site; - *pdwSiteData = This->SiteData; - if (This->Site) + if (This->Site) { IHlinkSite_AddRef(This->Site); + *pdwSiteData = This->SiteData; + } return S_OK; } @@ -307,8 +328,16 @@ static HRESULT WINAPI IHlink_fnGetMonikerReference(IHlink* iface, TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppimkTarget, ppwzLocation); - if(ppimkTarget) - __GetMoniker(This, ppimkTarget); + if (ppimkTarget) + { + HRESULT hres = __GetMoniker(This, ppimkTarget, dwWhichRef); + if (FAILED(hres)) + { + if (ppwzLocation) + *ppwzLocation = NULL; + return hres; + } + } if (ppwzLocation) IHlink_GetStringReference(iface, dwWhichRef, NULL, ppwzLocation); @@ -323,7 +352,6 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface, TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppwzTarget, ppwzLocation); - /* note: undocumented behavior with dwWhichRef == -1 */ if(dwWhichRef != -1 && dwWhichRef & ~(HLINKGETREF_DEFAULT | HLINKGETREF_ABSOLUTE | HLINKGETREF_RELATIVE)) { if(ppwzTarget) @@ -333,13 +361,16 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface, return E_INVALIDARG; } - if(dwWhichRef != HLINKGETREF_DEFAULT) - FIXME("unhandled flags: 0x%x\n", dwWhichRef); - if (ppwzTarget) { IMoniker* mon; - __GetMoniker(This, &mon); + HRESULT hres = __GetMoniker(This, &mon, dwWhichRef); + if (FAILED(hres)) + { + if (ppwzLocation) + *ppwzLocation = NULL; + return hres; + } if (mon) { IBindCtx *pbc; @@ -389,7 +420,12 @@ static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface, else { IMoniker *moniker; - __GetMoniker(This, &moniker); + HRESULT hres = __GetMoniker(This, &moniker, HLINKGETREF_DEFAULT); + if (FAILED(hres)) + { + *ppwzFriendlyName = NULL; + return hres; + } if (moniker) { IBindCtx *bcxt; @@ -440,20 +476,17 @@ static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc, { HlinkImpl *This = (HlinkImpl*)iface; IMoniker *mon = NULL; + HRESULT r; FIXME("Semi-Stub:(%p)->(%i %p %p %p)\n", This, grfHLNF, pbc, pbsc, phbc); - if (This->Site) - IHlinkSite_ReadyToNavigate(This->Site, This->SiteData, 0); - - __GetMoniker(This, &mon); + r = __GetMoniker(This, &mon, HLINKGETREF_ABSOLUTE); TRACE("Moniker %p\n", mon); - if (mon) + if (SUCCEEDED(r)) { IBindCtx *bcxt; IHlinkTarget *target = NULL; - HRESULT r = S_OK; CreateBindCtx(0, &bcxt); @@ -488,10 +521,10 @@ static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc, } if (This->Site) - IHlinkSite_OnNavigationComplete(This->Site, This->SiteData, 0, 0, NULL); + IHlinkSite_OnNavigationComplete(This->Site, This->SiteData, 0, r, NULL); TRACE("Finished Navigation\n"); - return S_OK; + return r; } static HRESULT WINAPI IHlink_fnSetAdditonalParams(IHlink* iface, @@ -782,14 +815,17 @@ end: static HRESULT WINAPI IPersistStream_fnSave(IPersistStream* iface, IStream* pStm, BOOL fClearDirty) { - HRESULT r = E_FAIL; + HRESULT r; HlinkImpl *This = HlinkImpl_from_IPersistStream(iface); DWORD hdr[2]; IMoniker *moniker; TRACE("(%p) Moniker(%p)\n", This, This->Moniker); - __GetMoniker(This, &moniker); + r = __GetMoniker(This, &moniker, HLINKGETREF_DEFAULT); + if (FAILED(r)) + return r; + r = E_FAIL; hdr[0] = HLINK_SAVE_MAGIC; hdr[1] = 0; @@ -850,7 +886,7 @@ end: static HRESULT WINAPI IPersistStream_fnGetSizeMax(IPersistStream* iface, ULARGE_INTEGER* pcbSize) { - HRESULT r = E_FAIL; + HRESULT r; HlinkImpl *This = HlinkImpl_from_IPersistStream(iface); IMoniker *moniker; @@ -864,7 +900,11 @@ static HRESULT WINAPI IPersistStream_fnGetSizeMax(IPersistStream* iface, if (This->FriendlyName) pcbSize->QuadPart += size_hlink_string(This->FriendlyName); - __GetMoniker(This, &moniker); + r = __GetMoniker(This, &moniker, HLINKGETREF_DEFAULT); + if (FAILED(r)) + return r; + r = E_FAIL; + if (moniker) { IPersistStream* monstream = NULL; diff --git a/reactos/dll/win32/shdocvw/De.rc b/reactos/dll/win32/shdocvw/De.rc new file mode 100644 index 00000000000..560d93deb1f --- /dev/null +++ b/reactos/dll/win32/shdocvw/De.rc @@ -0,0 +1,88 @@ +/* + * Copyright 2010 André Hentschel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "URL öffnen" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Geben Sie die Url ein, die Sie mit Internet Explorer öffnen möchten",-1,30, 5, 150,15 + LTEXT "Öffnen:", -1, 2, 32, 25, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 30, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 30, 50, 50, 15 + PUSHBUTTON "&Abbrechen", IDCANCEL, 90, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Datei" + { + POPUP "&Neu" + { + MENUITEM "&Fenster" ID_BROWSE_NEW_WINDOW + } + MENUITEM "Ö&ffnen...", ID_BROWSE_OPEN + MENUITEM "&Speichern", ID_BROWSE_SAVE + MENUITEM "Speichern &als...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Seite &einrichten...", ID_BROWSE_PRINT_FORMAT + MENUITEM "Dr&ucken...", ID_BROWSE_PRINT + MENUITEM "Seiten&vorschau...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "Ei&genschaften...", ID_BROWSE_PROPERTIES + MENUITEM "&Beenden", ID_BROWSE_QUIT + } + POPUP "&Ansicht" + { + POPUP "&Symbolleisten" + { + MENUITEM "&Standard" ID_BROWSE_BAR_STD + MENUITEM "&Adressleiste" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favoriten" + { + MENUITEM "&Zu den Favoriten hinzufügen..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Hilfe" + { + MENUITEM "Über &Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Zurück" + IDS_TB_FORWARD "Vorwärts" + IDS_TB_STOP "Stopp" + IDS_TB_REFRESH "Neu laden" + IDS_TB_HOME "Start" + IDS_TB_PRINT "Drucken" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adresse" +} diff --git a/reactos/dll/win32/shdocvw/En.rc b/reactos/dll/win32/shdocvw/En.rc index 749c849aa3c..7a4fe78bf61 100644 --- a/reactos/dll/win32/shdocvw/En.rc +++ b/reactos/dll/win32/shdocvw/En.rc @@ -49,9 +49,38 @@ IDR_BROWSE_MAIN_MENU MENU MENUITEM "Print previe&w...", ID_BROWSE_PRINT_PREVIEW MENUITEM SEPARATOR MENUITEM "&Properties...", ID_BROWSE_PROPERTIES + MENUITEM "&Close", ID_BROWSE_QUIT + } + POPUP "&View" + { + POPUP "&Toolbars" + { + MENUITEM "&Standard bar" ID_BROWSE_BAR_STD + MENUITEM "&Address bar" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favorites" + { + MENUITEM "&Add to Favorites..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR } POPUP "&Help" { MENUITEM "&About Internet Explorer...", ID_BROWSE_ABOUT } } + +STRINGTABLE +{ + IDS_TB_BACK "Back" + IDS_TB_FORWARD "Forward" + IDS_TB_STOP "Stop" + IDS_TB_REFRESH "Refresh" + IDS_TB_HOME "Home" + IDS_TB_PRINT "Print" +} + +STRINGTABLE +{ + IDS_ADDRESS "Address" +} diff --git a/reactos/dll/win32/shdocvw/Es.rc b/reactos/dll/win32/shdocvw/Es.rc new file mode 100644 index 00000000000..39715440998 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Es.rc @@ -0,0 +1,89 @@ +/* + * Spanish resources for shdocvw + * + * Copyright 2010 José Rostagno + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Abrir URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Especifique la dirección que desea abrir en Internet Explorer",-1,25, 5, 150,15 + LTEXT "Abrir:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&Aceptar", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Cancelar", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Archivo" + { + POPUP "&Nuevo" + { + MENUITEM "&Ventana" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Abrir...", ID_BROWSE_OPEN + MENUITEM "&Guardar", ID_BROWSE_SAVE + MENUITEM "Guardar &como...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Formato de impresión...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Imprimir...", ID_BROWSE_PRINT + MENUITEM "&Vista previa de impresión...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Propiedades...", ID_BROWSE_PROPERTIES + } + POPUP "&Ver" + { + POPUP "&Barra de herramientas" + { + MENUITEM "Barra &estándar" ID_BROWSE_BAR_STD + MENUITEM "Barra de &direcciones" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favoritos" + { + MENUITEM "&Añadir a Favoritos..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "A&yuda" + { + MENUITEM "Acerca &de Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Atrás" + IDS_TB_FORWARD "Adelante" + IDS_TB_STOP "Detener" + IDS_TB_REFRESH "Recargar" + IDS_TB_HOME "Inicio" + IDS_TB_PRINT "Imprimir" +} + +STRINGTABLE +{ + IDS_ADDRESS "Dirección" +} diff --git a/reactos/dll/win32/shdocvw/Fr.rc b/reactos/dll/win32/shdocvw/Fr.rc new file mode 100644 index 00000000000..1e17409b7f9 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Fr.rc @@ -0,0 +1,91 @@ +/* + * shdocvw French resources + * + * Copyright 2010 Frédéric Delanoy + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Open URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Spécifiez l'URL que vous désirez ouvrir dans Internet Explorer :",-1,30, 6, 150, 17 + LTEXT "Ouvrir :", -1, 2, 32, 27, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 30, 30, 155, 13 + DEFPUSHBUTTON "&OK", IDOK, 54, 50, 50, 15 + PUSHBUTTON "&Annuler", IDCANCEL, 114, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Fichier" + { + POPUP "&Nouvelle" + { + MENUITEM "&Fenêtre" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Ouvrir...", ID_BROWSE_OPEN + MENUITEM "&Enregistrer", ID_BROWSE_SAVE + MENUITEM "Enregistrer &sous...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Format d'impression...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Imprimer...", ID_BROWSE_PRINT + MENUITEM "&Aperçu avant impression...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Propriétés...", ID_BROWSE_PROPERTIES + MENUITEM "&Quitter", ID_BROWSE_QUIT + } + POPUP "&Afficher" + { + POPUP "&Barres d'outils" + { + MENUITEM "Barre &standard" ID_BROWSE_BAR_STD + MENUITEM "Barre d'&adresse" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favoris" + { + MENUITEM "&Ajouter aux favoris..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "A&ide" + { + MENUITEM "À &propos d'Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Précédent" + IDS_TB_FORWARD "Suivant" + IDS_TB_STOP "Arrêter" + IDS_TB_REFRESH "Recharger" + IDS_TB_HOME "Accueil" + IDS_TB_PRINT "Imprimer" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adresse" +} diff --git a/reactos/dll/win32/shdocvw/He.rc b/reactos/dll/win32/shdocvw/He.rc new file mode 100644 index 00000000000..a2789dfa90a --- /dev/null +++ b/reactos/dll/win32/shdocvw/He.rc @@ -0,0 +1,90 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 Yaron Shahrabani + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +EXSTYLE WS_EX_LAYOUTRTL +CAPTION "פתיחת כתובת" +FONT 8, "MS Shell Dlg" +{ + LTEXT "× × ×œ×¦×™×™×Ÿ ×ת הכתובת ×ותה ברצונך לפתוח ב×מצעות Internet Explorer",-1,25, 5, 150,15 + LTEXT "פתיחה:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&×ישור", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&ביטול", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&קובץ" + { + POPUP "&חדש" + { + MENUITEM "&חלון" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&פתיחה...", ID_BROWSE_OPEN + MENUITEM "&שמירה", ID_BROWSE_SAVE + MENUITEM "שמירה &בש×...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&תצורת ההדפסה...", ID_BROWSE_PRINT_FORMAT + MENUITEM "×”&דפסה...", ID_BROWSE_PRINT + MENUITEM "תצוגה מ&קדימה להדפסה...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "מ&×פייני×...", ID_BROWSE_PROPERTIES + MENUITEM "&סגירה", ID_BROWSE_QUIT + } + POPUP "&תצוגה" + { + POPUP "&סרגלי כלי×" + { + MENUITEM "סרגל ×”×›×œ×™× ×”&רגיל" ID_BROWSE_BAR_STD + MENUITEM "סרגל ×”&כתובות" ID_BROWSE_BAR_ADDR + } + } + POPUP "&מועדפי×" + { + MENUITEM "הו&ספה למועדפי×..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "×¢&זרה" + { + MENUITEM "על &×ודות Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "חזרה" + IDS_TB_FORWARD "קדימה" + IDS_TB_STOP "עצירה" + IDS_TB_REFRESH "רענון" + IDS_TB_HOME "דף הבית" + IDS_TB_PRINT "הדפסה" +} + +STRINGTABLE +{ + IDS_ADDRESS "כתובת" +} diff --git a/reactos/dll/win32/shdocvw/It.rc b/reactos/dll/win32/shdocvw/It.rc new file mode 100644 index 00000000000..7f39c2b08a2 --- /dev/null +++ b/reactos/dll/win32/shdocvw/It.rc @@ -0,0 +1,90 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 Luca Bennati + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Apri URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Specifica l'URL che vuoi aprire in Internet Explorer",-1,25, 5, 150,15 + LTEXT "Apri:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Annulla", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&File" + { + POPUP "&Nuova" + { + MENUITEM "Fin&estra" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Apri...", ID_BROWSE_OPEN + MENUITEM "&Salva", ID_BROWSE_SAVE + MENUITEM "Sa&lva come...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Imposta pagina...", ID_BROWSE_PRINT_FORMAT + MENUITEM "S&tampa...", ID_BROWSE_PRINT + MENUITEM "Antepri&ma di stampa...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Proprietà...", ID_BROWSE_PROPERTIES + MENUITEM "&Chiudi", ID_BROWSE_QUIT + } + POPUP "&Visualizza" + { + POPUP "&Barre degli strumenti" + { + MENUITEM "Barra &predefinita" ID_BROWSE_BAR_STD + MENUITEM "Barra dell'&indirizzo" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Preferiti" + { + MENUITEM "&Aggiungi ai Preferiti..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Aiuto" + { + MENUITEM "&Informazioni su Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Indietro" + IDS_TB_FORWARD "Avanti" + IDS_TB_STOP "Ferma" + IDS_TB_REFRESH "Aggiorna" + IDS_TB_HOME "Inizio" + IDS_TB_PRINT "Stampa" +} + +STRINGTABLE +{ + IDS_ADDRESS "Indirizzo" +} diff --git a/reactos/dll/win32/shdocvw/Ko.rc b/reactos/dll/win32/shdocvw/Ko.rc new file mode 100644 index 00000000000..613288d945b --- /dev/null +++ b/reactos/dll/win32/shdocvw/Ko.rc @@ -0,0 +1,88 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 YunSOng Hwang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "URL 열기" +FONT 8, "MS Shell Dlg" +{ + LTEXT "ì¸í„°ë„· ìµìŠ¤í”Œë¡œì–´ë¡œ ì—´ URL 지정",-1,25, 5, 150,15 + LTEXT "열기:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "확ì¸(&O)", IDOK, 25, 50, 50, 15 + PUSHBUTTON "취소(&C)", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "파ì¼(&F)" + { + POPUP "새 작업(&N)" + { + MENUITEM "ì°½(&W)" ID_BROWSE_NEW_WINDOW + } + MENUITEM "열기(&O)...", ID_BROWSE_OPEN + MENUITEM "저장(&S)", ID_BROWSE_SAVE + MENUITEM "다른 ì´ë¦„으로 저장(&A)...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "ì¸ì‡„ 형ì‹(&F)...", ID_BROWSE_PRINT_FORMAT + MENUITEM "ì¸ì‡„(&I)...", ID_BROWSE_PRINT + MENUITEM "ì¸ì‡„ 미리보기(&W)...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "ì†ì„±(&P)...", ID_BROWSE_PROPERTIES + } + POPUP "보기(&V)" + { + POPUP "ë„구바(&T)" + { + MENUITEM "표준 ë°”(&S)" ID_BROWSE_BAR_STD + MENUITEM "주소 ë°”(&A)" ID_BROWSE_BAR_ADDR + } + } + POPUP "ì¦ê²¨ì°¾ê¸°(&F)" + { + MENUITEM "ì¦ê²¨ì°¾ê¸° 추가(&A)..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "ë„움ë§(&H)" + { + MENUITEM "ì¸í„°ë„· ìµìŠ¤í”Œë¡œì–´ ì •ë³´(&A)...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "뒤로" + IDS_TB_FORWARD "앞으로" + IDS_TB_STOP "멈추기" + IDS_TB_REFRESH "새로 고침" + IDS_TB_HOME "홈" + IDS_TB_PRINT "ì¸ì‡„" +} + +STRINGTABLE +{ + IDS_ADDRESS "주소" +} diff --git a/reactos/dll/win32/shdocvw/Lt.rc b/reactos/dll/win32/shdocvw/Lt.rc new file mode 100644 index 00000000000..b9c0b04b2e3 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Lt.rc @@ -0,0 +1,89 @@ +/* + * Copyright 2010 Aurimas FiÅ¡eras + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Atverti URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Nurodykite URL, kurį norite atverti su interneto narÅ¡ykle",-1 ,30, 5, 150, 16 + LTEXT "Atverti:", -1, 2, 32, 25, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 30, 30, 160, 13 + DEFPUSHBUTTON "&Gerai", IDOK, 30, 50, 50, 15 + PUSHBUTTON "&Atsisakyti", IDCANCEL, 90, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Failas" + { + POPUP "&Naujas" + { + MENUITEM "&Langas" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Atverti...", ID_BROWSE_OPEN + MENUITEM "&IÅ¡saugoti", ID_BROWSE_SAVE + MENUITEM "IÅ¡saugoti &kaip...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Spaudinio &formatas...", ID_BROWSE_PRINT_FORMAT + MENUITEM "S&pausdinti...", ID_BROWSE_PRINT + MENUITEM "Spaudinio pe&ržiÅ«ra...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&SavybÄ—s...", ID_BROWSE_PROPERTIES + MENUITEM "&Užverti", ID_BROWSE_QUIT + } + POPUP "&Rodymas" + { + POPUP "&Ä®rankių juosta" + { + MENUITEM "Ä®&prastinÄ— juosta" ID_BROWSE_BAR_STD + MENUITEM "&Adreso juosta" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Adresynas" + { + MENUITEM "Ä®&raÅ¡yti į adresynÄ…..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Žinynas" + { + MENUITEM "&Apie interneto narÅ¡yklÄ™...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Atgal" + IDS_TB_FORWARD "Pirmyn" + IDS_TB_STOP "Stabdyti" + IDS_TB_REFRESH "Atnaujinti" + IDS_TB_HOME "Pradžia" + IDS_TB_PRINT "Spausdinti" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adresas" +} diff --git a/reactos/dll/win32/shdocvw/Nl.rc b/reactos/dll/win32/shdocvw/Nl.rc new file mode 100644 index 00000000000..fc5a1f397c0 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Nl.rc @@ -0,0 +1,86 @@ +/* + * Copyright 2010 Sven Baars + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Open URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Specificeer de URL die u wilt openen in Internet Explorer",-1,25, 5, 150,15 + LTEXT "Open:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Annuleren", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Bestand" + { + POPUP "&Nieuw" + { + MENUITEM "&Venster" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Openen...", ID_BROWSE_OPEN + MENUITEM "Op&slaan", ID_BROWSE_SAVE + MENUITEM "Ops&laan als...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Pa&gina-instellingen...", ID_BROWSE_PRINT_FORMAT + MENUITEM "Af&drukken...", ID_BROWSE_PRINT + MENUITEM "Afdruk&voorbeeld...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Eigenschappen...", ID_BROWSE_PROPERTIES + MENUITEM "&Afsluiten", ID_BROWSE_QUIT + } + POPUP "Bee&ld" + { + POPUP "&Werkbalken" + { + MENUITEM "&Standaardbalk" ID_BROWSE_BAR_STD + MENUITEM "&Adresbalk" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favorieten" + { + MENUITEM "&Toevoegen aan Favorieten..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Help" + { + MENUITEM "&Over Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Terug" + IDS_TB_FORWARD "Vooruit" + IDS_TB_STOP "Stoppen" + IDS_TB_REFRESH "Vernieuwen" + IDS_TB_HOME "Startpagina" + IDS_TB_PRINT "Printen" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adres" +} diff --git a/reactos/dll/win32/shdocvw/Pl.rc b/reactos/dll/win32/shdocvw/Pl.rc new file mode 100644 index 00000000000..5a6ada86e6e --- /dev/null +++ b/reactos/dll/win32/shdocvw/Pl.rc @@ -0,0 +1,87 @@ +/* + * Copyright 2010 £ukasz Wojni³owicz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Otwórz URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Podaj adres URL, który chcesz otworzyæ w Internet Explorerze",-1,25, 5, 150,15 + LTEXT "Otwórz:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Anuluj", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Plik" + { + POPUP "&Nowe" + { + MENUITEM "&Okno" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Otwórz...", ID_BROWSE_OPEN + MENUITEM "&Zapisz", ID_BROWSE_SAVE + MENUITEM "Zapisz &jako...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Forma&t wydruku...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Drukuj...", ID_BROWSE_PRINT + MENUITEM "Podgl¹&d wydruku...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&W³aœciwoœci...", ID_BROWSE_PROPERTIES + MENUITEM "&Zamknij...", ID_BROWSE_QUIT + } + POPUP "&Widok" + { + POPUP "&Paski narzêdzi" + { + MENUITEM "Pasek &standardowy" ID_BROWSE_BAR_STD + MENUITEM "&Pasek adresu" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Ulubione" + { + MENUITEM "&Dodaj do ulubionych..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Pomoc" + { + MENUITEM "&O Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Wstecz" + IDS_TB_FORWARD "Dalej" + IDS_TB_STOP "Zatrzymaj" + IDS_TB_REFRESH "Odœwierz" + IDS_TB_HOME "Strona g³ówna" + IDS_TB_PRINT "Drukuj" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adres" +} diff --git a/reactos/dll/win32/shdocvw/Pt.rc b/reactos/dll/win32/shdocvw/Pt.rc new file mode 100644 index 00000000000..9dff39c58c8 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Pt.rc @@ -0,0 +1,94 @@ +/* + * Copyright 2010 Gustavo Henrique Milaré + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Abrir URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Especifique a URL que você deseja abrir no Internet Explorer",-1,25, 5, 150,15 + LTEXT "Abrir:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Cancelar", IDCANCEL, 85, 50, 50, 15 +} + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Arquivo" + { + POPUP "&Novo" + { + MENUITEM "&Janela" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Abrir...", ID_BROWSE_OPEN + MENUITEM "&Salvar", ID_BROWSE_SAVE + MENUITEM "Salvar &como...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Imprimir &formato...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Imprimir...", ID_BROWSE_PRINT + MENUITEM "&Vizualizar impressão...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Propriedades...", ID_BROWSE_PROPERTIES + MENUITEM "&Fechar", ID_BROWSE_QUIT + } + POPUP "&Ver" + { + POPUP "&Ferramentas" + { + MENUITEM "Barra &padrão" ID_BROWSE_BAR_STD + MENUITEM "Barra de &endereço" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favoritos" + { + MENUITEM "&Adicionar aos Favoritos..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "A&juda" + { + MENUITEM "&Sobre o Internet Explorer...", ID_BROWSE_ABOUT + } +} + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +STRINGTABLE +{ + IDS_TB_BACK "Voltar" + IDS_TB_FORWARD "Avançar" + IDS_TB_STOP "Parar" + IDS_TB_REFRESH "Atualizar" + IDS_TB_HOME "Início" + IDS_TB_PRINT "Imprimir" +} + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +STRINGTABLE +{ + IDS_ADDRESS "Endereço" +} diff --git a/reactos/dll/win32/shdocvw/Ro.rc b/reactos/dll/win32/shdocvw/Ro.rc new file mode 100644 index 00000000000..38c51caab8d --- /dev/null +++ b/reactos/dll/win32/shdocvw/Ro.rc @@ -0,0 +1,60 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 Michael Stefaniuc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL + +#pragma code_page(65001) + +IDD_BROWSE_OPEN DIALOG 10, 10, 210, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Deschide URL-ul" +FONT 8, "MS Shell Dlg" +{ + LTEXT "SpecificaÈ›i URL-ul pe care doriÈ›i să îl deschideÈ›i în Internet Explorer",-1,35, 5, 160,15 + LTEXT "Deschide:", -1, 2, 32, 30, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 35, 30, 170, 13 + DEFPUSHBUTTON "&OK", IDOK, 35, 50, 50, 15 + PUSHBUTTON "&Renunță", IDCANCEL, 95, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&FiÈ™ier" + { + POPUP "&Nou" + { + MENUITEM "&Fereastră" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Deschidere...", ID_BROWSE_OPEN + MENUITEM "&Salvează", ID_BROWSE_SAVE + MENUITEM "S&alvare ca...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Format tipărire...", ID_BROWSE_PRINT_FORMAT + MENUITEM "T&ipărire...", ID_BROWSE_PRINT + MENUITEM "Pre&vizualizare imprimare...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Proprietăți...", ID_BROWSE_PROPERTIES + } + POPUP "&Ajutor" + { + MENUITEM "&Despre Internet Explorer...", ID_BROWSE_ABOUT + } +} diff --git a/reactos/dll/win32/shdocvw/Si.rc b/reactos/dll/win32/shdocvw/Si.rc new file mode 100644 index 00000000000..35d501444c5 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Si.rc @@ -0,0 +1,88 @@ +/* + * Copyright 2010 Matej Spindler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Open URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Vnesite interneti naslov dokumenta, ki ga bo Internet Explorer odpru.",-1,25, 5, 150,15 + LTEXT "Odpri:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&V redu", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&PrekliÄi", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Datoteka" + { + POPUP "&Nov" + { + MENUITEM "&Okno" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Odpri ...", ID_BROWSE_OPEN + MENUITEM "&Shrani", ID_BROWSE_SAVE + MENUITEM "Shrani &kot ...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Nastavitve tiskanja ...", ID_BROWSE_PRINT_FORMAT + MENUITEM "Na&tisni ...", ID_BROWSE_PRINT + MENUITEM "Predo&gled tiskanja ...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Lastnosti ...", ID_BROWSE_PROPERTIES + MENUITEM "&Zapri", ID_BROWSE_QUIT + } + POPUP "Pogl&ed" + { + POPUP "Oro&dne vrstice" + { + MENUITEM "&Statusna vrstica" ID_BROWSE_BAR_STD + MENUITEM "&Naslovna vrstica" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Priljubljene" + { + MENUITEM "&Dodaj med priljubljene ..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&PomoÄ" + { + MENUITEM "O programu Internet Explorer ...",ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Nazaj" + IDS_TB_FORWARD "Naprej" + IDS_TB_STOP "Stop" + IDS_TB_REFRESH "Osveži" + IDS_TB_HOME "Domov" + IDS_TB_PRINT "Natisni" +} + +STRINGTABLE +{ + IDS_ADDRESS "Naslov" +} diff --git a/reactos/dll/win32/shdocvw/Sr.rc b/reactos/dll/win32/shdocvw/Sr.rc new file mode 100644 index 00000000000..5fd9e72b9b2 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Sr.rc @@ -0,0 +1,156 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 ÄorÄ‘e Vasiljević + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Отварање адреÑе" +FONT 8, "MS Shell Dlg" +{ + LTEXT "УнеÑите адреÑу коју желите да отворите у Internet Explorer-у",-1,25, 5, 150,15 + LTEXT "Отвори:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&У реду", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Откажи", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Датотека" + { + POPUP "&Ðово" + { + MENUITEM "&Прозор" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Отвори...", ID_BROWSE_OPEN + MENUITEM "&Сачувај", ID_BROWSE_SAVE + MENUITEM "Сачувај &као...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Формат &штампе...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Штампај...", ID_BROWSE_PRINT + MENUITEM "&Преглед штампе...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&СвојÑтва...", ID_BROWSE_PROPERTIES + MENUITEM "&Затвори", ID_BROWSE_QUIT + } + POPUP "&Приказ" + { + POPUP "&Ðлатнице" + { + MENUITEM "&Стандардна трака" ID_BROWSE_BAR_STD + MENUITEM "&Трака за навигацију" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Омиљено" + { + MENUITEM "&Додај у омиљене..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Помоћ" + { + MENUITEM "&О Internet Explorer-у...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Ðазад" + IDS_TB_FORWARD "Ðапред" + IDS_TB_STOP "ЗауÑтави" + IDS_TB_REFRESH "ОÑвежи" + IDS_TB_HOME "Почетна" + IDS_TB_PRINT "Штампај" +} + +STRINGTABLE +{ + IDS_ADDRESS "ÐдреÑа" +} + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Otvaranje adrese" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Unesite adresu koju želite da otvorite u Internet Explorer-u",-1,25, 5, 150,15 + LTEXT "Otvori:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&U redu", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Otkaži", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Datoteka" + { + POPUP "&Novo" + { + MENUITEM "&Prozor" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Otvori...", ID_BROWSE_OPEN + MENUITEM "&SaÄuvaj", ID_BROWSE_SAVE + MENUITEM "SaÄuvaj &kao...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Format &Å¡tampe...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Å tampaj...", ID_BROWSE_PRINT + MENUITEM "&Pregled Å¡tampe...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Svojstva...", ID_BROWSE_PROPERTIES + MENUITEM "&Zatvori", ID_BROWSE_QUIT + } + POPUP "&Prikaz" + { + POPUP "&Alatnice" + { + MENUITEM "&Standardna traka" ID_BROWSE_BAR_STD + MENUITEM "&Traka za navigaciju" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Omiljeno" + { + MENUITEM "&Dodaj u omiljene..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Pomoć" + { + MENUITEM "&O Internet Explorer-u...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Nazad" + IDS_TB_FORWARD "Napred" + IDS_TB_STOP "Zaustavi" + IDS_TB_REFRESH "Osveži" + IDS_TB_HOME "PoÄetna" + IDS_TB_PRINT "Å tampaj" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adresa" +} diff --git a/reactos/dll/win32/shdocvw/Sv.rc b/reactos/dll/win32/shdocvw/Sv.rc new file mode 100644 index 00000000000..f71d4edf311 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Sv.rc @@ -0,0 +1,88 @@ +/* + * Copyright 2010 Anders Jonsson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Öppna webbadress" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Ange webbadressen du vill öppna med Internet Explorer",-1,25, 5, 150,15 + LTEXT "Öppna:", -1, 2, 32, 20, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 25, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 25, 50, 50, 15 + PUSHBUTTON "&Avbryt", IDCANCEL, 85, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Arkiv" + { + POPUP "&Nytt" + { + MENUITEM "&Fönster" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Öppna...", ID_BROWSE_OPEN + MENUITEM "&Spara", ID_BROWSE_SAVE + MENUITEM "S¶ som...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "U&tskriftsformat...", ID_BROWSE_PRINT_FORMAT + MENUITEM "Skriv &ut...", ID_BROWSE_PRINT + MENUITEM "&Förhandsgranska...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "&Egenskaper...", ID_BROWSE_PROPERTIES + MENUITEM "Stä&ng", ID_BROWSE_QUIT + } + POPUP "&Visa" + { + POPUP "Verktygs&fält" + { + MENUITEM "&Standardfält" ID_BROWSE_BAR_STD + MENUITEM "&Adressfält" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Favoriter" + { + MENUITEM "&Lägg till favoriter..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Hjälp" + { + MENUITEM "&Om Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "BakÃ¥t" + IDS_TB_FORWARD "FramÃ¥t" + IDS_TB_STOP "Stopp" + IDS_TB_REFRESH "Uppdatera" + IDS_TB_HOME "Hem" + IDS_TB_PRINT "Skriv ut" +} + +STRINGTABLE +{ + IDS_ADDRESS "Adress" +} diff --git a/reactos/dll/win32/shdocvw/Uk.rc b/reactos/dll/win32/shdocvw/Uk.rc new file mode 100644 index 00000000000..95e14849644 --- /dev/null +++ b/reactos/dll/win32/shdocvw/Uk.rc @@ -0,0 +1,90 @@ +/* + * Copyright 2010 Alexander N. Sørnes + * Copyright 2010 Igor Paliychuk + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "resource.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +IDD_BROWSE_OPEN DIALOG 10, 10, 200, 70 +STYLE DS_MODALFRAME | WS_CAPTION +CAPTION "Відкрити URL" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Вкажіть URL, що ви хочете відкрити в Internet Explorer",-1,25, 5, 150,15 + LTEXT "Відкрити:", -1, 2, 32, 30, 15 + EDITTEXT IDC_BROWSE_OPEN_URL, 35, 30, 160, 13 + DEFPUSHBUTTON "&OK", IDOK, 45, 50, 50, 15 + PUSHBUTTON "&СкаÑувати", IDCANCEL, 105, 50, 50, 15 +} + +IDR_BROWSE_MAIN_MENU MENU +{ + POPUP "&Файл" + { + POPUP "&Створити" + { + MENUITEM "&Вікно" ID_BROWSE_NEW_WINDOW + } + MENUITEM "&Відкрити...", ID_BROWSE_OPEN + MENUITEM "&Зберегти", ID_BROWSE_SAVE + MENUITEM "Зберегти &Ñк...", ID_BROWSE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Формат друку...", ID_BROWSE_PRINT_FORMAT + MENUITEM "&Друк...", ID_BROWSE_PRINT + MENUITEM "Попередній пе&реглÑд...", ID_BROWSE_PRINT_PREVIEW + MENUITEM SEPARATOR + MENUITEM "Ð’&лаÑтивоÑті...", ID_BROWSE_PROPERTIES + MENUITEM "За&крити", ID_BROWSE_QUIT + } + POPUP "&ВиглÑд" + { + POPUP "&Панелі інÑтрументів" + { + MENUITEM "&Стандартна панель" ID_BROWSE_BAR_STD + MENUITEM "РÑдок &адреÑи" ID_BROWSE_BAR_ADDR + } + } + POPUP "&Обране" + { + MENUITEM "&Додати до Обраного..." ID_BROWSE_ADDFAV + MENUITEM SEPARATOR + } + POPUP "&Довідка" + { + MENUITEM "&Про Internet Explorer...", ID_BROWSE_ABOUT + } +} + +STRINGTABLE +{ + IDS_TB_BACK "Ðазад" + IDS_TB_FORWARD "Вперед" + IDS_TB_STOP "Зупинити" + IDS_TB_REFRESH "Оновити" + IDS_TB_HOME "Додому" + IDS_TB_PRINT "Друк" +} + +STRINGTABLE +{ + IDS_ADDRESS "ÐдреÑа" +} diff --git a/reactos/dll/win32/shdocvw/dochost.c b/reactos/dll/win32/shdocvw/dochost.c index b3db0125700..f74d06413ac 100644 --- a/reactos/dll/win32/shdocvw/dochost.c +++ b/reactos/dll/win32/shdocvw/dochost.c @@ -311,7 +311,7 @@ void create_doc_view_hwnd(DocHost *This) doc_view_atom = RegisterClassExW(&wndclass); } - GetClientRect(This->frame_hwnd, &rect); /* FIXME */ + This->container_vtbl->GetDocObjRect(This, &rect); This->hwnd = CreateWindowExW(0, wszShell_DocObject_View, wszShell_DocObject_View, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP, @@ -447,8 +447,14 @@ static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface, nCmdexecopt, debugstr_variant(pvaIn), debugstr_variant(pvaOut)); if(!pguidCmdGroup) { - FIXME("Unimplemented cmdid %d\n", nCmdID); - return E_NOTIMPL; + switch(nCmdID) { + case OLECMDID_UPDATECOMMANDS: + return This->container_vtbl->exec(This, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); + default: + FIXME("Unimplemented cmdid %d\n", nCmdID); + return E_NOTIMPL; + } + return S_OK; } if(IsEqualGUID(pguidCmdGroup, &CGID_DocHostCmdPriv)) { @@ -783,7 +789,7 @@ static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = { PropertyNotifySink_OnRequestEdit }; -void DocHost_Init(DocHost *This, IDispatch *disp) +void DocHost_Init(DocHost *This, IDispatch *disp, const IDocHostContainerVtbl* container) { This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl; This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl; @@ -791,6 +797,8 @@ void DocHost_Init(DocHost *This, IDispatch *disp) This->disp = disp; + This->container_vtbl = container; + This->client_disp = NULL; This->document = NULL; diff --git a/reactos/dll/win32/shdocvw/frame.c b/reactos/dll/win32/shdocvw/frame.c index eeff20adcb3..2f089c12595 100644 --- a/reactos/dll/win32/shdocvw/frame.c +++ b/reactos/dll/win32/shdocvw/frame.c @@ -33,6 +33,9 @@ static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = INPLACEFRAME(This); + }else if(IsEqualGUID(&IID_IOleWindow, riid)) { + TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv); + *ppv = INPLACEFRAME(This); }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) { TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv); *ppv = INPLACEFRAME(This); @@ -135,8 +138,8 @@ static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText) { DocHost *This = INPLACEFRAME_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(pszStatusText)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_w(pszStatusText)); + return This->container_vtbl->SetStatusText(This, pszStatusText); } static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable) diff --git a/reactos/dll/win32/shdocvw/ie.c b/reactos/dll/win32/shdocvw/ie.c index 9d661ca7071..2a048e3ae8f 100644 --- a/reactos/dll/win32/shdocvw/ie.c +++ b/reactos/dll/win32/shdocvw/ie.c @@ -47,6 +47,8 @@ static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFII }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) { TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv); *ppv = CONPTCONT(&This->doc_host.cps); + }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) { + return S_OK; } if(*ppv) { @@ -394,8 +396,10 @@ static HRESULT WINAPI InternetExplorer_get_StatusText(IWebBrowser2 *iface, BSTR static HRESULT WINAPI InternetExplorer_put_StatusText(IWebBrowser2 *iface, BSTR StatusText) { InternetExplorer *This = WEBBROWSER_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(StatusText)); + + return update_ie_statustext(This, StatusText); } static HRESULT WINAPI InternetExplorer_get_ToolBar(IWebBrowser2 *iface, int *Value) @@ -426,19 +430,11 @@ static HRESULT WINAPI InternetExplorer_put_MenuBar(IWebBrowser2 *iface, VARIANT_ TRACE("(%p)->(%x)\n", This, Value); - if((menu = GetMenu(This->frame_hwnd))) - DestroyMenu(menu); - - menu = NULL; - if(Value) - menu = LoadMenuW(shdocvw_hinstance, MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU)); + menu = This->menu; if(!SetMenu(This->frame_hwnd, menu)) - { - DestroyMenu(menu); return HRESULT_FROM_WIN32(GetLastError()); - } return S_OK; } diff --git a/reactos/dll/win32/shdocvw/ietoolbar.bmp b/reactos/dll/win32/shdocvw/ietoolbar.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d4123627329ac55b8632a0d6606523af95be1122 GIT binary patch literal 24698 zcmeHv1z48X|Ng6B&UQ}c+;p2u-AoWcXX|uRF|cN!BLox!2?NC<#EIQaNhk^!l$3-h zh$!76Ar}3D!RLQ}o|jjN7g49b>;Jv3oy*&&&pFR|?oXccGIHV?b&*ik;Qu8+0MG+y zg#YER6{(9v9X^qO4<&^}BFR5Kq()U|dGj{=)o%Z9x8V_Jj9Z!kt$=pGr@&`G=c;W- zY}*1YfhIupPk_V!slxBt6ySIH5a7DF&V~x#$K%@p;PL&C;5xZ(ZsWhw@CdNlX#;#N z60JKa5}8BOybCski$q_1kLOuNm_z?o9{73YkUYTh#j@DE8u*yc^L4)OecIzX@V=t& zfS-Y1KM=Ssu9NGQ#lIF+*Lb}80Q~@k4-Br8>*hANAKd1DrS1qYZ(0Lg0gRQwu{Ldv zRg4*vN5B96h{lb3M59MPq*0^tY54F5G;G)d8ang=DJ$pF;K8{xXiyF*C}dOT&X=Bx zMC)%rg$+bK-vBHJ%-6Rq+z;jo%MSO4Z4TQQsmFn9F%V*D- zQ;z+&2H!7WHn#k{EXJYVPgdH~!ebBpV#?wjGTPHEP>dGj8IhK4Wi z+_^)EiHY>&=~Mb=&(0dyv3D0qaWCs0#mC3L6)s=COa=x9p=k9hfaOtI_W5eH*eDQ8#gID;s%9`|bOY-;rxAMTxbGuw0x7$kIP`OmzXh=?z znZ4LYWWC1UlzoH`)V8Hn`}QZqlP2X;_wIMW=W9SP@IEq-N}qpz6*6E288G7*OjhA{ zY&NuKmriyX17B=X{dq2qdjQ`7tlydUgOtDPFwJ^KZ&&cV%z63n60c3up9k((K-c$a zQp7$D3g4|x*Q{re@21Ig-f%>Pou)#?Vf6ui!+z{A7|-_r*!N()A(a7c_f=6-Qz-w^&dIW`n*CAnH6dV#tLDxbkFgTd}1B2*lKp^?~ z`;(8~Rr2=rqbuG%f?Pn>UTSG+F{j?9ux@4UF}HZ!*sts;>e-=N)0N5|zwT8RZ%A>a zriMdaiaNGnJKagRE|GKQBy*PST^)Ucb8jkqKR?IMb3L#8UwK0n@pNyCmn}_(mB`KQ z`xmaUZeu^8cH8Vn@O#$y&NzNUvEJ69!wK=!sgI~fk63U%6bJ#{PX^@Wz3JzlQ{g`a zy?_j)ibUI3uh%X-#w`YY{aI&ln;dnN%XCM6JrU=A0{RU2y6sq-*?rs`bq1IDTKx6w z)+rOZZD&G}$MosO0ZqETcOkexkHU7%rSP492?(>9L)W%VBM+ld&mady%f|FnLtS42 z96#__^4M^@uZo$OS!3q^J?P-r*jUPY@PIa3nb*MsYBT+Et|dr2_PQ@>nOM3X^mf z+H&7R!v8kSdg8wB0FN{48Xjxbc`P@~v(WJ90&tK zNnSpbKKtw@_TOv=TD0(|cJ0_t;&?#f3rS=kg}(eUeFS!x<7v~#JLi`?SDUuJ!?TR_G>BfurBod-xRTT5nbQ2kgo4u zK;gS!2ZZf>3b*--LjRdfq1$It$aXdI-S`LDYbul&jP5xO?eMrr^?z-h)QEX}|Nec! zr_agFrA?MwX|p9{pbC?B?4>3LoM@G$rNIAG_$S6jMr5ZsunufB6@+V9Sy_UQ1pX&f zf9Y!b0{_|H`q=zWNKASg{!6*fI-hj~j~Vm%E4j%(OmAWQTfq!(%NNVj9O#>96WWsF zDdGPoO@GBbth2rcz5$r8%tf}jT+iFcfRy|Ejii1s*Tei~f8ZzZzkEZc8>uGlC6fe4 z>R~m#Tux8XS=6d&uc~|a-s-U**HuT~;as({&HCGK9m|(5e~P?L8n_w_zDH5><`E<( z7fvQ71$6M>b5c}Hs8j@1#Ab)&TAQvlk=h6Vk#OMCb^?(3$Cle`X79Jn9F`u^Zz=zJ}T*sqDLHbouPr&}jh zQuIj!ia4l4AvW-V{+SERp|G8EDeRwF6komlFmM8Y7OifKw>oh1iA@HB$?T^j>wDgR( z;XmtX=4y5B_h>x7uVIIEqsz3z5746cqxAXp<@D*zWwa%`ivKN|DB&6QReu3EX6p%b z2c$BIOh5UUs&M(z4O#HY84HQF{ic3&eZ47-{L0A2j3Qb z-+l=0`vH*3ANxgYL%2@%<5;$973-rv{^(l1c5M-IoaxlRe_R#r(!hat$;_;fe0|F( zKfjoE?|w$Tda++r(+;#~5lrUhC5ZLPVDF1*|9&xb>B4@~YZ++V_zHdZT>^dcO*GD1 z6xHg4X!rP@%^b88EA#ILP;Rsr#a}!?**7mzy8kJPb>2ibkLc0OLpl_7d>P$wTu(8M z8z|6bQKg&7@5S~yN@ZsjE0XIHC34jpL@v66DjgONBDa;ppZjl~EXaV<5|xr8^ZU<5 zyE4W=(i`S~F7!V8HCf>8M)NH-VS!_S(djNDEg0v1z;5MAmRzJxYsxl^+> z!=A|-DAOCUN}0bo+Z6VzWEFYD)9d7y4zhth-z~RTVV|7#zyorc0}jh+3^*#csQ(GM zh5b&UjTh_F&(Y^MR#JyhJ^Crkn2Zt}Xt>L&7xJrAp2|slUA7fH0BOu8l|31Lka^|C zjm0!!LOKl?5GP>Zz&LO}4%{!IkdRU;!nY|YDWQS_F?9Sh`t{e>cA#a;Q0TT&_{`;0 zTwIKM3Meb9fOhOCr;Z(2PF~AEqehoeZw}6xSJoZ?XSH5U1^&kcQJUXz%D&-2slG=k z`SLzWzO;{$JaNgT zi>RHSCbbWQ3|!NpO&J$xOZo-coOYfzr?}Ck#Iv+9-i0>abtbdhXJ|u|1FgSdC&&is z=DZX0UzQG%XZcY$sY8mVb!m|O5*p;FPfAY9NXc~t4L-Y)l+PQ`kc&pNG4niq9=?p) z2kTHfe=X|br$buNM`(_(b!7|VVP%bH|GFG)^Z=wWxs?Ah?7n%WrDdtWcjml;Lc9P) z#dunD!%3oArCSV&Ep z@LYj(en1irC@RY4{~@gbO*sC27=MjYybn=|*Fj3Yasb#*8G&|m|N40fKWh8}dcEw} zqJdkN5AVV6$K%Ohy}~w|?Q7GJ&EvPk+O3YykH2;@J=kHVi~f)jccalSI1a$|dJFSE zFE5Wc2jt=DNox_mGS+R}Ai#8!8Li*EQNR^1FUWZonHU>W&_NRlJ#I#!C(Hyn@ZYn7 zd|(e)Hn={H6V|L*^QfMN1^$c6%gNc*l}bv>=+^Dqv~%|!DlHTLYjAxhPM#F_Ur+eij;7*_UE_#=aHHcdcSxX>DEhiu26-L4#gn?%X^&dX#0Ln3(@!u^2orCu{3xq^BoF zY*#LvXZuiCSV+Oa#iXmt+~>K1+H+)AP@)^(Z1cu)(`N4HcTTQyf0%I1FhAkij40bp^Bor}Jx84S()sVfY}cz5 z`vLOu&Uf_mu4^#=^O5)DoQ*wvkpqVg)eFZnXM|Y65;nrb#H0=|=S$Xzn;#&r!+sL- z|Ak$$nKYF9T52c{P}Ys|DTutkg{`fDK0({IjDTd&jSIukfWSjASX|_ z&iAlx&$`dZrh8fU(Qif;WupHXnG&R=Wg!0_fxPH7e7o|7_|M&vlUt&w+QMX5@eKDZ zm73S~P$%bk0-syC{Y9-k<_j{wc7Wxetq*`Lb5P*^`FZq->l|u%W+pYaoleb;tJ3-i z=Ko;ke?1(OjE02&w$$vz6l!iaomx80qEF7EO?OF~ZN1PI_|Eo+QA6g=&!taXX44qo z4YWM;Fm>BHSuDR|u)C=DXB-2tZmdV{%q#!-r|cEym6YO%F?jH6%$t`-hYmdh?@I)( zvm6u^iIFR*5RTdJVcj1XSVD^y6@mLaS0Hu{P8&UTCeeP11Xo&6=&@wLI{8PYnYOxan{p@U~>_wFgk zDY(>#g_kT@Qdn78N$-M}xc}wLm+uT+D5p1!UL$!U71NHUW6QLBchW2$OX^}bkG^nT zNZrn9P-i#j+4BnoJ~G$Y7BE_01Rxi!nEPkJeehPQ`P)l%{?Fq{Ox5IMAc1D0y<}Org*G`RoIk$uiLXQy7Psp!QjuZXeuRB_i z<#XY*d8Lg_Sq;uBD<@!0j|3_z3B;H;FJH**6crT|$`A=L+hd zCstO@do%x&!YS3KO8<49CccWCl)8wEtxY$-(vCr!flf8#Pxk+xYeM3mbB~box`g=i26&q%@RqsG`5=}DDfqZHq#Uol zmC6a*l6C8DP^V58>4zU4()ZtIAfN1d|5XRD1O9Kg85#Nf#fuljcEHZgj!wd7`4BjE z>=?03vuzFt2zaKar^mjr%z}BaRWn^R| zh783}&z?8HqflzqD!9rAs%Zy!y__ul?~M6Z=I7(22*C&9I3ORfFz16fC(4NT-2W2( zKh`@8;GEhU%j4wm8a%hv=sy%W(8skOV*amLQ%dva7gO)vPq5x23^`ywN>0uaWPoD< z=6iMhF4gVTw^I3#Zdn%6(lSX+EdcrCAjsDfa6cL26J3Y@n0s!ze8q|^ZiD%6Wo1PU z4i1RDPSNSpr|ZDh)|O;}<)%8gj;&j_3f#w9ipnKRmfq!gzS?6TJ(e>Xvak1!xn=ue zJjf*c1WmrOiBzv_rYSyKX{w(&P4l;;sewR{6-|L}J}KCOM*44{f!>Dn)5WFq^?7aT zepZ9Nb=9IDTozMrCmrhLw3uveyAkv-)&ab^F#mVOT%dj~OKHHlWu)kCKuVX4NZD&O z4e?n+Dt>FIulFkId3gza>aH&MM(pzl_6D|sZAP=>Q>f|TNdh{am`Q7{pQMo|m%Wr* zrJOChb@R$yyTpRNXYMoShYpqCx8D*-iV-7{1%Lngb%~$P`b3Hc4+?4h`U?8vj||Ab zZTM2rm@9}vOc9BE(oN)xB9J!?$6Rn2V(P~-`EO<>YRvq1UN%DPylf=E+bZY}7dr#4 z24lnym?Hy^W1Mw+aoqdX<V^uMS^dU*x5I$b!rA z!N3957p(bei)!i4C^xda9jkvs)hIkm0lG_Rz;Hpo3T=Zz??eiS}z7_xX-t{1*b1O*M4Y?k7Bl_*)Y8rlJ zEsgXsrBS}?X_Vgv8g+F8jr3bjie5(a{RLg>?7V>5*&|jsHJw@X(z%4-r1`fOlIk3yv%2j z(;RH4t&nT4rC8b!9JCZ__#OPbRR6OKtX*4*e0d3Ew*Wl7kF`sl(7mxj{L1Tm*cLG7 zA7QSR!G1+`NMqf=z(maTxnmwM3EY1K?#Btd|MuHRmWN8j+lYbdFW{^Yhet+63Tr2L zD+|27j!}KxUG+72+&4?iRZD%q`dh4d1#2w-Y`<=Fv3Zz%<)OGsq#3x27F_*@7WnU= z1pzx~Uf>Rz6S!TF1vRz_SIudX?`9hBwSh)oTuZ|*7}JpRt7s5-+~0L6?S@W={(n}p zmAXf){}04oq~9(W(Fk`F8s)KCsBi3LQ~KS@jK=$H6y$8Y??(FF*Nnz`Ll(SDA#-bJ zsD}}$AV11&j`dte7LiUg(bfq5ze<#7l`^lzsHaHy&pMxVy_EA3-Y3$?kty&E%HcZ} z3g7(kDxtr@}P1~bfX}~UZG1g_D z5}Ea?Z@#T+{LL%(>=D=C{)iFG`$YWCB?bO#IqdJ#S9YIuil=80;^A^qRecD*zZ|jQ z!&lccGxK3@#rU0!LgXFchzm^IjK-IygZByUJLrysDaF{W#hRft!hCU7_<6F^QWV#%#IZ+{ zCN9YnCZs-R?i(0L_`h^%3EsaD9DXeL?=xoxV_ih5ur?wAYmnI%NNpd-xGWd@_C;aM zw$D$ zM<)_|=vcfL9f`X_2cggR-SJ@kUs3Zd>mITG=jWDQJ4nky4$(^Fa10=KEPF;_$0P_p zPKM#fXu6LDP4R*}AVy*Nm~e3e8RMG8^)u9M^TcxYx_Bj-o4^idjB=|6KT?< zGU&6XuXGCAcQ>~Jnm%0&ZY0AmN`%k<06qifLLUhFhjma&N-oWu`5Zn~5@Lbd@F${Q z@n2WBKqmj~{vN2p{6DR!aN^v`(ZM$k=x?~PVd@bF?ZK;M^;*_B`^8E-+}BKo44kIB zSTk|!81y!-XLS*ovJEcifrdL_t}m*D-15Vt(V z8dk(HeZAm^BqH8V5Y|5PIw9sgZw-yZsdE=EA;+ZD9P-HJ3ktVzSunl!7R<++^%T>eLp zxB2kLI6tfAZB8>G3)azR$=L7E%QkCA7RVbasWjBq>+2SkTecL@!iCuapCx)f5&Aoc z#*fd&`Eq>YTp|DG?*4?POex2;RPbM7BUlE;kAH-i*KQuapBPW%chZXNYZMeds83 z^m6EDwgaxP3vEnBJ{Q4Oyb)%@dG70t1#2zTAt%Q5!a!vWuDx`I&C!G}Hvj5&Ay3OT zM*rf@=gp0WrHG7&eD%gg>Rhxm>e}^`*up|015*Bv8Iwd~$0kAl-N$d{Dv)oJ=>4%{ zQ;4sze6S2K|2b9|H!h#Fw8V%B3b2l@2>GN~NzYPTpYYt|5@7A zQu3ijZub8GyE26%A zIWEqk_Mdu^&7Mfao$>T@A20a(oa1>4-Jb*ACjp6q476|WQv&XL!oIvyJR{}5G`}X@ zO4gQy)sX>bXJ;WU;Oo`#A^Fea4epKnbp5!(T{q5E+QZjb5ptN=FKV+I{Qtiw$aygT z&!vTuUeJCrgimxj!I!4ltr5fD@fR5ncq{u_x2qOrUAvwvv$QP6H_sNhE#?2XaV!Jb zG<9kTc%2HKC)MCT%M0_Lm_vwv#ecQ|lP0CX?|+2#aK}o)eZ9KvOU^)l zKTf%7N1morOJE0Xz$S?8wH0_Rbj)du{y#~d<2;eQM*jhhx=M%bb(KoIE#{TQdF;Ww z*%69$*+MZ6>+ld-2dyZVwyEe zVh8&7F96RU(WjmLs8u^RQbyK6EX)C<;Jab76rgLc_(Ep?A*zJhbZox72;h} zig&XjwgqwSyM*%@f%dHb-$73uYYm_MTL1o0V&=Y@S`lf7c+0ru{)P5yKk9XE@wDY{lhhEVcMn3@ls36BGS~% z5qQpgua4^6XWcLLf0+NALzVEK*G|L>++VTc3Alffx!+(s&hxqsy2{1r!7h|{=PKph z_N9z#F8D3LL5ewNL$MzFC>8c0C+aeOBj7FkJ|HXH4Zgh-WkSDa1ldz2@}0a^G{x^E z*3A7`;;>lh*&SDF;=B;_|2yg_e|b4MCx@@T3Vf=nT7Z04kr3BRm{5q=rr;I#fA}F2 z+|K~_Q?MrX{Nu)rUG@LXH(~yB?vitwp`oEN!Lfjwn;X`rht#>w`6$LmqfowA-}td^l!IzK{hfJ*OiR5PA>T(k^Q)LeOFocga0piT@~~9-+ab52^|0}Cc z|G%6Q{{Bycb6Ovwx0cIT2F%TiFlU=9_&MzBNc|mY%v)XWOS!*pT@m6!C+5E8`}V{^ zYrv2*ddiue>(xqP&f35aa-}@@JnZ*Ke4k60m+_$S|ec{{JF1^#n#%8ZI zeqaIa3hQ^?cguC`+_`g~wBG-=?>Yij`W-tSEZexT0CSt=0(h=W3Z6ISwR1K${JY39 z+P19>>&S{RUwVeQzvo?Bt9?J5%0}>6MneuxpV1qViTQytC;bs(Y{iI)OPrPrxpPKm z@KMAKs=Ows_VcxmVFwn~KKJg&&Mn~Mcz*Fk$kT7WNx@nkmn@OU_J?<`=f5ZZH%7pG z0oE(SZ+Mr#e`~e-Afcc>R#a{o{=QoeQ F{{yG6)#3mE literal 0 HcmV?d00001 diff --git a/reactos/dll/win32/shdocvw/ietoolbar.svg b/reactos/dll/win32/shdocvw/ietoolbar.svg new file mode 100644 index 00000000000..24866a919c6 --- /dev/null +++ b/reactos/dll/win32/shdocvw/ietoolbar.svg @@ -0,0 +1,285 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/dll/win32/shdocvw/iexplore.c b/reactos/dll/win32/shdocvw/iexplore.c index fa643feecfa..a0d2684894f 100644 --- a/reactos/dll/win32/shdocvw/iexplore.c +++ b/reactos/dll/win32/shdocvw/iexplore.c @@ -34,6 +34,9 @@ #include "shdocvw.h" #include "mshtmcid.h" #include "shellapi.h" +#include "winreg.h" +#include "shlwapi.h" +#include "intshcut.h" #include "wine/debug.h" @@ -41,12 +44,299 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); #define IDI_APPICON 1 +#define DOCHOST_THIS(iface) DEFINE_THIS2(InternetExplorer,doc_host,iface) + static const WCHAR szIEWinFrame[] = { 'I','E','F','r','a','m','e',0 }; /* Windows uses "Microsoft Internet Explorer" */ static const WCHAR wszWineInternetExplorer[] = {'W','i','n','e',' ','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0}; +HRESULT update_ie_statustext(InternetExplorer* This, LPCWSTR text) +{ + if(!SendMessageW(This->status_hwnd, SB_SETTEXTW, MAKEWORD(SB_SIMPLEID, 0), (LPARAM)text)) + return E_FAIL; + + return S_OK; +} + +static void adjust_ie_docobj_rect(HWND frame, RECT* rc) +{ + HWND hwndRebar = GetDlgItem(frame, IDC_BROWSE_REBAR); + HWND hwndStatus = GetDlgItem(frame, IDC_BROWSE_STATUSBAR); + INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0); + + rc->top += barHeight; + rc->bottom -= barHeight; + + if(IsWindowVisible(hwndStatus)) + { + RECT statusrc; + + GetClientRect(hwndStatus, &statusrc); + rc->bottom -= statusrc.bottom - statusrc.top; + } +} + +static HMENU get_tb_menu(HMENU menu) +{ + HMENU menu_view = GetSubMenu(menu, 1); + + return GetSubMenu(menu_view, 0); +} + +static HMENU get_fav_menu(HMENU menu) +{ + return GetSubMenu(menu, 2); +} + +static LPWSTR get_fav_url_from_id(HMENU menu, UINT id) +{ + MENUITEMINFOW item; + + item.cbSize = sizeof(item); + item.fMask = MIIM_DATA; + + if(!GetMenuItemInfoW(menu, id, FALSE, &item)) + return NULL; + + return (LPWSTR)item.dwItemData; +} + +static void free_fav_menu_data(HMENU menu) +{ + LPWSTR url; + int i; + + for(i = 0; (url = get_fav_url_from_id(menu, ID_BROWSE_GOTOFAV_FIRST + i)); i++) + heap_free( url ); +} + +static int get_menu_item_count(HMENU menu) +{ + MENUITEMINFOW item; + int count = 0; + int i; + + item.cbSize = sizeof(item); + item.fMask = MIIM_DATA | MIIM_SUBMENU; + + for(i = 0; GetMenuItemInfoW(menu, i, TRUE, &item); i++) + { + if(item.hSubMenu) + count += get_menu_item_count(item.hSubMenu); + else + count++; + } + + return count; +} + +static void add_fav_to_menu(HMENU favmenu, HMENU menu, LPWSTR title, LPCWSTR url) +{ + MENUITEMINFOW item; + /* Subtract the number of standard elements in the Favorites menu */ + int favcount = get_menu_item_count(favmenu) - 2; + LPWSTR urlbuf; + + if(favcount > (ID_BROWSE_GOTOFAV_MAX - ID_BROWSE_GOTOFAV_FIRST)) + { + FIXME("Add support for more than %d Favorites\n", favcount); + return; + } + + urlbuf = heap_alloc((lstrlenW(url) + 1) * sizeof(WCHAR)); + + if(!urlbuf) + return; + + lstrcpyW(urlbuf, url); + + item.cbSize = sizeof(item); + item.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_DATA | MIIM_ID; + item.fType = MFT_STRING; + item.dwTypeData = title; + item.wID = ID_BROWSE_GOTOFAV_FIRST + favcount; + item.dwItemData = (ULONG_PTR)urlbuf; + InsertMenuItemW(menu, -1, TRUE, &item); +} + +static void add_favs_to_menu(HMENU favmenu, HMENU menu, LPCWSTR dir) +{ + WCHAR path[MAX_PATH*2]; + const WCHAR search[] = {'*',0}; + WCHAR* filename; + HANDLE findhandle; + WIN32_FIND_DATAW finddata; + IUniformResourceLocatorW* urlobj; + IPersistFile* urlfile; + HRESULT res; + + lstrcpyW(path, dir); + PathAppendW(path, search); + + findhandle = FindFirstFileW(path, &finddata); + + if(findhandle == INVALID_HANDLE_VALUE) + return; + + res = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, &IID_IUniformResourceLocatorW, (PVOID*)&urlobj); + + if(SUCCEEDED(res)) + res = IUnknown_QueryInterface(urlobj, &IID_IPersistFile, (PVOID*)&urlfile); + + if(SUCCEEDED(res)) + { + filename = path + lstrlenW(path) - lstrlenW(search); + + do + { + lstrcpyW(filename, finddata.cFileName); + + if(finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + MENUITEMINFOW item; + const WCHAR ignore1[] = {'.','.',0}; + const WCHAR ignore2[] = {'.',0}; + + if(!lstrcmpW(filename, ignore1) || !lstrcmpW(filename, ignore2)) + continue; + + item.cbSize = sizeof(item); + item.fMask = MIIM_STRING | MIIM_SUBMENU; + item.dwTypeData = filename; + item.hSubMenu = CreatePopupMenu(); + InsertMenuItemW(menu, -1, TRUE, &item); + add_favs_to_menu(favmenu, item.hSubMenu, path); + } else + { + WCHAR* fileext; + WCHAR* url = NULL; + const WCHAR urlext[] = {'.','u','r','l',0}; + + if(lstrcmpiW(PathFindExtensionW(filename), urlext)) + continue; + + if(FAILED(IPersistFile_Load(urlfile, path, 0))) + continue; + + urlobj->lpVtbl->GetURL(urlobj, &url); + + if(!url) + continue; + + fileext = filename + lstrlenW(filename) - lstrlenW(urlext); + *fileext = 0; + add_fav_to_menu(favmenu, menu, filename, url); + } + } while(FindNextFileW(findhandle, &finddata)); + } + + if(urlfile) + IPersistFile_Release(urlfile); + + if(urlobj) + IUnknown_Release(urlobj); + + FindClose(findhandle); +} + +static void add_tbs_to_menu(HMENU menu) +{ + HUSKEY toolbar_handle; + WCHAR toolbar_key[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'I','n','t','e','r','n','e','t',' ', + 'E','x','p','l','o','r','e','r','\\', + 'T','o','o','l','b','a','r',0}; + + if(SHRegOpenUSKeyW(toolbar_key, KEY_READ, NULL, &toolbar_handle, TRUE) == ERROR_SUCCESS) + { + HUSKEY classes_handle; + WCHAR classes_key[] = {'S','o','f','t','w','a','r','e','\\', + 'C','l','a','s','s','e','s','\\','C','L','S','I','D',0}; + WCHAR guid[39]; + DWORD value_len = sizeof(guid)/sizeof(guid[0]); + int i; + + if(SHRegOpenUSKeyW(classes_key, KEY_READ, NULL, &classes_handle, TRUE) != ERROR_SUCCESS) + { + SHRegCloseUSKey(toolbar_handle); + ERR("Failed to open key %s\n", debugstr_w(classes_key)); + return; + } + + for(i = 0; SHRegEnumUSValueW(toolbar_handle, i, guid, &value_len, NULL, NULL, NULL, SHREGENUM_HKLM) == ERROR_SUCCESS; i++) + { + WCHAR tb_name[100]; + DWORD tb_name_len = sizeof(tb_name)/sizeof(tb_name[0]); + HUSKEY tb_class_handle; + MENUITEMINFOW item; + LSTATUS ret; + value_len = sizeof(guid)/sizeof(guid[0]); + + if(lstrlenW(guid) != 38) + { + TRACE("Found invalid IE toolbar entry: %s\n", debugstr_w(guid)); + continue; + } + + if(SHRegOpenUSKeyW(guid, KEY_READ, classes_handle, &tb_class_handle, TRUE) != ERROR_SUCCESS) + { + ERR("Failed to get class info for %s\n", debugstr_w(guid)); + continue; + } + + ret = SHRegQueryUSValueW(tb_class_handle, NULL, NULL, tb_name, &tb_name_len, TRUE, NULL, 0); + + SHRegCloseUSKey(tb_class_handle); + + if(ret != ERROR_SUCCESS) + { + ERR("Failed to get toolbar name for %s\n", debugstr_w(guid)); + continue; + } + + item.cbSize = sizeof(item); + item.fMask = MIIM_STRING; + item.dwTypeData = tb_name; + InsertMenuItemW(menu, GetMenuItemCount(menu), TRUE, &item); + } + + SHRegCloseUSKey(classes_handle); + SHRegCloseUSKey(toolbar_handle); + } +} + +static HMENU create_ie_menu(void) +{ + HMENU menu = LoadMenuW(shdocvw_hinstance, MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU)); + HMENU favmenu = get_fav_menu(menu); + WCHAR path[MAX_PATH]; + + add_tbs_to_menu(get_tb_menu(menu)); + + if(SHGetFolderPathW(NULL, CSIDL_COMMON_FAVORITES, NULL, SHGFP_TYPE_CURRENT, path) == S_OK) + add_favs_to_menu(favmenu, favmenu, path); + + if(SHGetFolderPathW(NULL, CSIDL_FAVORITES, NULL, SHGFP_TYPE_CURRENT, path) == S_OK) + add_favs_to_menu(favmenu, favmenu, path); + + return menu; +} + +static void ie_navigate(InternetExplorer* This, LPCWSTR url) +{ + VARIANT variant; + + V_VT(&variant) = VT_BSTR; + V_BSTR(&variant) = SysAllocString(url); + + IWebBrowser2_Navigate2(WEBBROWSER2(This), &variant, NULL, NULL, NULL, NULL); + + SysFreeString(V_BSTR(&variant)); +} + static INT_PTR CALLBACK ie_dialog_open_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { static InternetExplorer* This; @@ -81,7 +371,7 @@ static INT_PTR CALLBACK ie_dialog_open_proc(HWND hwnd, UINT msg, WPARAM wparam, V_VT(&url) = VT_BSTR; V_BSTR(&url) = SysAllocStringLen(NULL, len); - GetWindowTextW(hwndurl, V_BSTR(&url), len); + GetWindowTextW(hwndurl, V_BSTR(&url), len + 1); IWebBrowser2_Navigate2(WEBBROWSER2(This), &url, NULL, NULL, NULL, NULL); SysFreeString(V_BSTR(&url)); @@ -105,32 +395,169 @@ static void ie_dialog_about(HWND hwnd) DestroyIcon(icon); } +static void add_tb_separator(HWND hwnd) +{ + TBBUTTON btn; + + ZeroMemory(&btn, sizeof(btn)); + + btn.iBitmap = 3; + btn.fsStyle = BTNS_SEP; + SendMessageW(hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn); +} + +static void add_tb_button(HWND hwnd, int bmp, int cmd, int strId) +{ + TBBUTTON btn; + WCHAR buf[30]; + + LoadStringW(shdocvw_hinstance, strId, buf, sizeof(buf)/sizeof(buf[0])); + + btn.iBitmap = bmp; + btn.idCommand = cmd; + btn.fsState = TBSTATE_ENABLED; + btn.fsStyle = BTNS_SHOWTEXT; + btn.dwData = 0; + btn.iString = (INT_PTR)buf; + + SendMessageW(hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn); +} + +static void create_rebar(HWND hwnd) +{ + HWND hwndRebar; + HWND hwndAddress; + HWND hwndToolbar; + REBARINFO rebarinf; + REBARBANDINFOW bandinf; + WCHAR addr[40]; + HIMAGELIST imagelist; + WCHAR idb_ietoolbar[] = {'I','D','B','_','I','E','T','O','O','L','B','A','R',0}; + + LoadStringW(shdocvw_hinstance, IDS_ADDRESS, addr, sizeof(addr)/sizeof(addr[0])); + + hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0, hwnd, (HMENU)IDC_BROWSE_REBAR, shdocvw_hinstance, NULL); + + rebarinf.cbSize = sizeof(rebarinf); + rebarinf.fMask = 0; + rebarinf.himl = NULL; + rebarinf.cbSize = sizeof(rebarinf); + + SendMessageW(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rebarinf); + + hwndToolbar = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndRebar, (HMENU)IDC_BROWSE_TOOLBAR, shdocvw_hinstance, NULL); + + imagelist = ImageList_LoadImageW(shdocvw_hinstance, idb_ietoolbar, 32, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION); + + SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)imagelist); + SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + add_tb_button(hwndToolbar, 0, 0, IDS_TB_BACK); + add_tb_button(hwndToolbar, 1, 0, IDS_TB_FORWARD); + add_tb_button(hwndToolbar, 2, 0, IDS_TB_STOP); + add_tb_button(hwndToolbar, 3, 0, IDS_TB_REFRESH); + add_tb_button(hwndToolbar, 4, ID_BROWSE_HOME, IDS_TB_HOME); + add_tb_separator(hwndToolbar); + add_tb_button(hwndToolbar, 5, ID_BROWSE_PRINT, IDS_TB_PRINT); + SendMessageW(hwndToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(55,50)); + SendMessageW(hwndToolbar, TB_AUTOSIZE, 0, 0); + + bandinf.cbSize = sizeof(bandinf); + bandinf.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE; + bandinf.fStyle = RBBS_CHILDEDGE; + bandinf.cx = 100; + bandinf.cyMinChild = 52; + bandinf.hwndChild = hwndToolbar; + + SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf); + + hwndAddress = CreateWindowExW(0, WC_COMBOBOXEXW, NULL, WS_BORDER|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN, 0, 0, 100,20,hwndRebar, (HMENU)IDC_BROWSE_ADDRESSBAR, shdocvw_hinstance, NULL); + + bandinf.fMask |= RBBIM_TEXT; + bandinf.fStyle = RBBS_CHILDEDGE | RBBS_BREAK; + bandinf.lpText = addr; + bandinf.cyMinChild = 20; + bandinf.hwndChild = hwndAddress; + + SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf); +} + static LRESULT iewnd_OnCreate(HWND hwnd, LPCREATESTRUCTW lpcs) { + InternetExplorer* This = (InternetExplorer*)lpcs->lpCreateParams; SetWindowLongPtrW(hwnd, 0, (LONG_PTR) lpcs->lpCreateParams); + + This->menu = create_ie_menu(); + + This->status_hwnd = CreateStatusWindowW(CCS_NODIVIDER|WS_CHILD|WS_VISIBLE, NULL, hwnd, IDC_BROWSE_STATUSBAR); + SendMessageW(This->status_hwnd, SB_SIMPLE, TRUE, 0); + + create_rebar(hwnd); + return 0; } static LRESULT iewnd_OnSize(InternetExplorer *This, INT width, INT height) { + HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR); + INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0); + RECT docarea = {0, 0, width, height}; + + SendMessageW(This->status_hwnd, WM_SIZE, 0, 0); + + adjust_ie_docobj_rect(This->frame_hwnd, &docarea); + if(This->doc_host.hwnd) - SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height, + SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwndRebar, NULL, 0, 0, width, barHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; +} + +static LRESULT iewnd_OnNotify(InternetExplorer *This, WPARAM wparam, LPARAM lparam) +{ + NMHDR* hdr = (NMHDR*)lparam; + + if(hdr->idFrom == IDC_BROWSE_ADDRESSBAR && hdr->code == CBEN_ENDEDITW) + { + NMCBEENDEDITW* info = (NMCBEENDEDITW*)lparam; + + if(info->fChanged && info->iWhy == CBENF_RETURN && info->szText) + { + VARIANT vt; + + V_VT(&vt) = VT_BSTR; + V_BSTR(&vt) = SysAllocString(info->szText); + + IWebBrowser2_Navigate2(WEBBROWSER2(This), &vt, NULL, NULL, NULL, NULL); + + SysFreeString(V_BSTR(&vt)); + + return 0; + } + } + return 0; } static LRESULT iewnd_OnDestroy(InternetExplorer *This) { + HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR); + HWND hwndToolbar = GetDlgItem(hwndRebar, IDC_BROWSE_TOOLBAR); + HIMAGELIST list = (HIMAGELIST)SendMessageW(hwndToolbar, TB_GETIMAGELIST, 0, 0); + TRACE("%p\n", This); + free_fav_menu_data(get_fav_menu(This->menu)); + ImageList_Destroy(list); This->frame_hwnd = NULL; PostQuitMessage(0); /* FIXME */ return 0; } -static LRESULT CALLBACK iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +static LRESULT iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(LOWORD(wparam)) { @@ -152,16 +579,43 @@ static LRESULT CALLBACK iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT } break; + case ID_BROWSE_HOME: + IWebBrowser2_GoHome(WEBBROWSER2(This)); + break; + case ID_BROWSE_ABOUT: ie_dialog_about(hwnd); break; + case ID_BROWSE_QUIT: + iewnd_OnDestroy(This); + break; + default: + if(LOWORD(wparam) >= ID_BROWSE_GOTOFAV_FIRST && LOWORD(wparam) <= ID_BROWSE_GOTOFAV_MAX) + { + LPCWSTR url = get_fav_url_from_id(get_fav_menu(This->menu), LOWORD(wparam)); + + if(url) + ie_navigate(This, url); + } return DefWindowProcW(hwnd, msg, wparam, lparam); } return 0; } +static LRESULT update_addrbar(InternetExplorer *This, LPARAM lparam) +{ + HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR); + HWND hwndAddress = GetDlgItem(hwndRebar, IDC_BROWSE_ADDRESSBAR); + HWND hwndEdit = (HWND)SendMessageW(hwndAddress, CBEM_GETEDITCONTROL, 0, 0); + LPCWSTR url = (LPCWSTR)lparam; + + SendMessageW(hwndEdit, WM_SETTEXT, 0, (LPARAM)url); + + return 0; +} + static LRESULT CALLBACK ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -177,8 +631,12 @@ ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam)); case WM_COMMAND: return iewnd_OnCommand(This, hwnd, msg, wparam, lparam); + case WM_NOTIFY: + return iewnd_OnNotify(This, wparam, lparam); case WM_DOCHOSTTASK: return process_dochost_task(&This->doc_host, lparam); + case WM_UPDATEADDRBAR: + return update_addrbar(This, lparam); } return DefWindowProcW(hwnd, msg, wparam, lparam); } @@ -264,6 +722,35 @@ static IWebBrowser2 *create_ie_window(LPCSTR cmdline) return wb; } +static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc) +{ + GetClientRect(This->frame_hwnd, rc); + adjust_ie_docobj_rect(This->frame_hwnd, rc); +} + +static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text) +{ + InternetExplorer* ie = DOCHOST_THIS(This); + return update_ie_statustext(ie, text); +} + +static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url) +{ + SendMessageW(This->frame_hwnd, WM_UPDATEADDRBAR, 0, (LPARAM)url); +} + +static HRESULT DocHostContainer_exec(DocHost* This, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in, + VARIANT *out) +{ + return S_OK; +} +static const IDocHostContainerVtbl DocHostContainerVtbl = { + DocHostContainer_GetDocObjRect, + DocHostContainer_SetStatusText, + DocHostContainer_SetURL, + DocHostContainer_exec +}; + HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv) { InternetExplorer *ret; @@ -275,10 +762,12 @@ HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv) ret->ref = 0; ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret); - DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret)); + DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret), &DocHostContainerVtbl); InternetExplorer_WebBrowser_Init(ret); + HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)WEBBROWSER2(ret), &ret->doc_host); + create_frame_hwnd(ret); ret->doc_host.frame_hwnd = ret->frame_hwnd; diff --git a/reactos/dll/win32/shdocvw/intshcut.c b/reactos/dll/win32/shdocvw/intshcut.c index 8c17873453a..202a523d1f3 100644 --- a/reactos/dll/win32/shdocvw/intshcut.c +++ b/reactos/dll/win32/shdocvw/intshcut.c @@ -27,11 +27,17 @@ * The installer for the Zuma Deluxe Popcap game is good for testing. */ +#include +#include + #include "wine/debug.h" #include "shdocvw.h" #include "objidl.h" #include "shobjidl.h" #include "intshcut.h" +#include "shellapi.h" +#include "winreg.h" +#include "shlwapi.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); @@ -237,8 +243,47 @@ static HRESULT WINAPI UniformResourceLocatorW_GetUrl(IUniformResourceLocatorW *u static HRESULT WINAPI UniformResourceLocatorW_InvokeCommand(IUniformResourceLocatorW *url, PURLINVOKECOMMANDINFOW pCommandInfo) { - FIXME("(%p, %p): stub\n", url, pCommandInfo); - return E_NOTIMPL; + InternetShortcut *This = impl_from_IUniformResourceLocatorW(url); + WCHAR app[64]; + HKEY hkey; + static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0}; + SHELLEXECUTEINFOW sei; + DWORD res, type; + HRESULT hres; + + TRACE("%p %p\n", This, pCommandInfo ); + + if (pCommandInfo->dwcbSize < sizeof (URLINVOKECOMMANDINFOW)) + return E_INVALIDARG; + + if (pCommandInfo->dwFlags != IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB) + { + FIXME("(%p, %p): non-default verbs not implemented\n", url, pCommandInfo); + return E_NOTIMPL; + } + + hres = CoInternetParseUrl(This->url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0); + if(FAILED(hres)) + return E_FAIL; + + res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey); + if(res != ERROR_SUCCESS) + return E_FAIL; + + res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL); + RegCloseKey(hkey); + if(res != ERROR_SUCCESS || type != REG_SZ) + return E_FAIL; + + memset(&sei, 0, sizeof(sei)); + sei.cbSize = sizeof(sei); + sei.lpFile = This->url; + sei.nShow = SW_SHOW; + + if( ShellExecuteExW(&sei) ) + return S_OK; + else + return E_FAIL; } static HRESULT WINAPI UniformResourceLocatorA_QueryInterface(IUniformResourceLocatorA *url, REFIID riid, PVOID *ppvObject) @@ -299,8 +344,26 @@ static HRESULT WINAPI UniformResourceLocatorA_GetUrl(IUniformResourceLocatorA *u static HRESULT WINAPI UniformResourceLocatorA_InvokeCommand(IUniformResourceLocatorA *url, PURLINVOKECOMMANDINFOA pCommandInfo) { - FIXME("(%p, %p): stub\n", url, pCommandInfo); - return E_NOTIMPL; + URLINVOKECOMMANDINFOW wideCommandInfo; + int len; + WCHAR *wideVerb; + HRESULT res; + InternetShortcut *This = impl_from_IUniformResourceLocatorA(url); + + wideCommandInfo.dwcbSize = sizeof wideCommandInfo; + wideCommandInfo.dwFlags = pCommandInfo->dwFlags; + wideCommandInfo.hwndParent = pCommandInfo->hwndParent; + + len = MultiByteToWideChar(CP_ACP, 0, pCommandInfo->pcszVerb, -1, NULL, 0); + wideVerb = heap_alloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, pCommandInfo->pcszVerb, -1, wideVerb, len); + + wideCommandInfo.pcszVerb = wideVerb; + + res = UniformResourceLocatorW_InvokeCommand(&This->uniformResourceLocatorW, &wideCommandInfo); + heap_free(wideVerb); + + return res; } static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *pFile, REFIID riid, PVOID *ppvObject) @@ -506,6 +569,22 @@ static const IPersistFileVtbl persistFileVtbl = { PersistFile_GetCurFile }; +static InternetShortcut *create_shortcut(void) +{ + InternetShortcut *newshortcut; + + newshortcut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InternetShortcut)); + if (newshortcut) + { + newshortcut->uniformResourceLocatorA.lpVtbl = &uniformResourceLocatorAVtbl; + newshortcut->uniformResourceLocatorW.lpVtbl = &uniformResourceLocatorWVtbl; + newshortcut->persistFile.lpVtbl = &persistFileVtbl; + newshortcut->refCount = 0; + } + + return newshortcut; +} + HRESULT InternetShortcut_Create(IUnknown *pOuter, REFIID riid, void **ppv) { InternetShortcut *This; @@ -518,13 +597,9 @@ HRESULT InternetShortcut_Create(IUnknown *pOuter, REFIID riid, void **ppv) if(pOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InternetShortcut)); + This = create_shortcut(); if (This) { - This->uniformResourceLocatorA.lpVtbl = &uniformResourceLocatorAVtbl; - This->uniformResourceLocatorW.lpVtbl = &uniformResourceLocatorWVtbl; - This->persistFile.lpVtbl = &persistFileVtbl; - This->refCount = 0; hr = Unknown_QueryInterface(This, riid, ppv); if (SUCCEEDED(hr)) SHDOCVW_LockModule(); @@ -535,3 +610,39 @@ HRESULT InternetShortcut_Create(IUnknown *pOuter, REFIID riid, void **ppv) else return E_OUTOFMEMORY; } + + +/********************************************************************** + * OpenURL (SHDOCVW.@) + */ +void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd) +{ + InternetShortcut *shortcut; + WCHAR* urlfilepath = NULL; + shortcut = create_shortcut(); + + if (shortcut) + { + int len; + + len = MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, NULL, 0); + urlfilepath = heap_alloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, urlfilepath, len); + + if(SUCCEEDED(IPersistFile_Load(&shortcut->persistFile, urlfilepath, 0))) + { + URLINVOKECOMMANDINFOW ici; + + memset( &ici, 0, sizeof ici ); + ici.dwcbSize = sizeof ici; + ici.dwFlags = IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB; + ici.hwndParent = hWnd; + + if FAILED(UniformResourceLocatorW_InvokeCommand(&shortcut->uniformResourceLocatorW, (PURLINVOKECOMMANDINFOW) &ici)) + TRACE("failed to open URL: %s\n.",debugstr_a(lpcstrUrl)); + } + + heap_free(shortcut); + heap_free(urlfilepath); + } +} diff --git a/reactos/dll/win32/shdocvw/navigate.c b/reactos/dll/win32/shdocvw/navigate.c index 6d73fd98b29..a160ee2b52e 100644 --- a/reactos/dll/win32/shdocvw/navigate.c +++ b/reactos/dll/win32/shdocvw/navigate.c @@ -125,6 +125,8 @@ static HRESULT set_dochost_url(DocHost *This, const WCHAR *url) heap_free(This->url); This->url = new_url; + + This->container_vtbl->SetURL(This, This->url); return S_OK; } @@ -759,7 +761,7 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags, Flags, Flags ? V_VT(Flags) : -1, TargetFrameName, TargetFrameName ? V_VT(TargetFrameName) : -1); - if(PostData && V_VT(PostData) == (VT_ARRAY | VT_UI1)) { + if(PostData && V_VT(PostData) == (VT_ARRAY | VT_UI1) && V_ARRAY(PostData)) { SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data); post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements; } @@ -781,7 +783,8 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags, DWORD size; size = sizeof(new_url)/sizeof(WCHAR); - hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME); + hres = UrlApplySchemeW(url, new_url, &size, + URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT); if(FAILED(hres)) { WARN("UrlApplyScheme failed: %08x\n", hres); new_url[0] = 0; @@ -881,30 +884,30 @@ HRESULT go_home(DocHost *This) return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL); } -#define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface) +#define HLINKFRAME_THIS(iface) DEFINE_THIS(HlinkFrame, IHlinkFrame, iface) static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_QueryInterface(This->outer, riid, ppv); } static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_AddRef(WEBBROWSER2(This)); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_AddRef(This->outer); } static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_Release(WEBBROWSER2(This)); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_Release(This->outer); } static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface, IHlinkBrowseContext *pihlbc) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%p)\n", This, pihlbc); return E_NOTIMPL; } @@ -912,7 +915,7 @@ static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface, static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface, IHlinkBrowseContext **ppihlbc) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%p)\n", This, ppihlbc); return E_NOTIMPL; } @@ -920,7 +923,7 @@ static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface, static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc, IBindStatusCallback *pibsc, IHlink *pihlNavigate) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); IMoniker *mon; LPWSTR location = NULL; @@ -945,13 +948,13 @@ static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPB return E_NOTIMPL; } - return navigate_hlink(&This->doc_host, mon, pbc, pibsc); + return navigate_hlink(This->doc_host, mon, pbc, pibsc); } static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF, IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), dwreserved); return E_NOTIMPL; @@ -960,7 +963,7 @@ static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF, static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID, IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName)); return E_NOTIMPL; @@ -979,106 +982,106 @@ static const IHlinkFrameVtbl HlinkFrameVtbl = { HlinkFrame_UpdateHlink }; -#define TARGETFRAME2_THIS(iface) DEFINE_THIS(WebBrowser, ITargetFrame2, iface) +#define TARGETFRAME2_THIS(iface) DEFINE_THIS(HlinkFrame, ITargetFrame2, iface) static HRESULT WINAPI TargetFrame2_QueryInterface(ITargetFrame2 *iface, REFIID riid, void **ppv) { - WebBrowser *This = TARGETFRAME2_THIS(iface); - return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv); + HlinkFrame *This = TARGETFRAME2_THIS(iface); + return IUnknown_QueryInterface(This->outer, riid, ppv); } static ULONG WINAPI TargetFrame2_AddRef(ITargetFrame2 *iface) { - WebBrowser *This = TARGETFRAME2_THIS(iface); - return IWebBrowser2_AddRef(WEBBROWSER2(This)); + HlinkFrame *This = TARGETFRAME2_THIS(iface); + return IUnknown_AddRef(This->outer); } static ULONG WINAPI TargetFrame2_Release(ITargetFrame2 *iface) { - WebBrowser *This = TARGETFRAME2_THIS(iface); - return IWebBrowser2_Release(WEBBROWSER2(This)); + HlinkFrame *This = TARGETFRAME2_THIS(iface); + return IUnknown_Release(This->outer); } static HRESULT WINAPI TargetFrame2_SetFrameName(ITargetFrame2 *iface, LPCWSTR pszFrameName) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameName)); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetFrameName(ITargetFrame2 *iface, LPWSTR *ppszFrameName) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%p)\n", This, ppszFrameName); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetParentFrame(ITargetFrame2 *iface, IUnknown **ppunkParent) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%p)\n", This, ppunkParent); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_SetFrameSrc(ITargetFrame2 *iface, LPCWSTR pszFrameSrc) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameSrc)); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetFrameSrc(ITargetFrame2 *iface, LPWSTR *ppszFrameSrc) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->()\n", This); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetFramesContainer(ITargetFrame2 *iface, IOleContainer **ppContainer) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%p)\n", This, ppContainer); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_SetFrameOptions(ITargetFrame2 *iface, DWORD dwFlags) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%x)\n", This, dwFlags); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetFrameOptions(ITargetFrame2 *iface, DWORD *pdwFlags) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%p)\n", This, pdwFlags); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_SetFrameMargins(ITargetFrame2 *iface, DWORD dwWidth, DWORD dwHeight) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%d %d)\n", This, dwWidth, dwHeight); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetFrameMargins(ITargetFrame2 *iface, DWORD *pdwWidth, DWORD *pdwHeight) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%p %p)\n", This, pdwWidth, pdwHeight); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_FindFrame(ITargetFrame2 *iface, LPCWSTR pszTargetName, DWORD dwFlags, IUnknown **ppunkTargetFrame) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(pszTargetName), dwFlags, ppunkTargetFrame); return E_NOTIMPL; } static HRESULT WINAPI TargetFrame2_GetTargetAlias(ITargetFrame2 *iface, LPCWSTR pszTargetName, LPWSTR *ppszTargetAlias) { - WebBrowser *This = TARGETFRAME2_THIS(iface); + HlinkFrame *This = TARGETFRAME2_THIS(iface); FIXME("(%p)->(%s %p)\n", This, debugstr_w(pszTargetName), ppszTargetAlias); return E_NOTIMPL; } @@ -1103,8 +1106,27 @@ static const ITargetFrame2Vtbl TargetFrame2Vtbl = { TargetFrame2_GetTargetAlias }; -void WebBrowser_HlinkFrame_Init(WebBrowser *This) +BOOL HlinkFrame_QI(HlinkFrame *This, REFIID riid, void **ppv) { - This->lpHlinkFrameVtbl = &HlinkFrameVtbl; - This->lpITargetFrame2Vtbl = &TargetFrame2Vtbl; + if(IsEqualGUID(&IID_IHlinkFrame, riid)) { + TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv); + *ppv = HLINKFRAME(This); + }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) { + TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv); + *ppv = TARGETFRAME2(This); + }else { + return FALSE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return TRUE; +} + +void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host) +{ + This->lpIHlinkFrameVtbl = &HlinkFrameVtbl; + This->lpITargetFrame2Vtbl = &TargetFrame2Vtbl; + + This->outer = outer; + This->doc_host = doc_host; } diff --git a/reactos/dll/win32/shdocvw/resource.h b/reactos/dll/win32/shdocvw/resource.h index 31a700566fb..6f5c777061f 100644 --- a/reactos/dll/win32/shdocvw/resource.h +++ b/reactos/dll/win32/shdocvw/resource.h @@ -24,6 +24,11 @@ #define IDR_BROWSE_MAIN_MENU 1000 #define IDD_BROWSE_OPEN 1001 #define IDC_BROWSE_OPEN_URL 1002 +#define IDC_BROWSE_REBAR 1003 +#define IDC_BROWSE_ADDRESSBAR 1004 +#define IDC_BROWSE_STATUSBAR 1005 +#define IDC_BROWSE_TOOLBAR 1006 +#define IDB_IETOOLBAR 1007 #define ID_BROWSE_NEW_WINDOW 275 #define ID_BROWSE_OPEN 256 @@ -33,4 +38,23 @@ #define ID_BROWSE_PRINT 260 #define ID_BROWSE_PRINT_PREVIEW 277 #define ID_BROWSE_PROPERTIES 262 +#define ID_BROWSE_QUIT 278 #define ID_BROWSE_ABOUT 336 + +#define ID_BROWSE_ADDFAV 1200 +#define ID_BROWSE_HOME 1201 + +#define ID_BROWSE_BAR_STD 1300 +#define ID_BROWSE_BAR_ADDR 1301 + +#define ID_BROWSE_GOTOFAV_FIRST 2000 +#define ID_BROWSE_GOTOFAV_MAX 65000 + +#define IDS_TB_BACK 1100 +#define IDS_TB_FORWARD 1101 +#define IDS_TB_STOP 1102 +#define IDS_TB_REFRESH 1103 +#define IDS_TB_HOME 1104 +#define IDS_TB_PRINT 1105 + +#define IDS_ADDRESS 1106 diff --git a/reactos/dll/win32/shdocvw/shdocvw.h b/reactos/dll/win32/shdocvw/shdocvw.h index d1787cb85c4..61dc63fb0e0 100644 --- a/reactos/dll/win32/shdocvw/shdocvw.h +++ b/reactos/dll/win32/shdocvw/shdocvw.h @@ -43,6 +43,8 @@ #include "resource.h" +#define WM_UPDATEADDRBAR (WM_APP+1) + /********************************************************************** * Shell Instance Objects */ @@ -66,6 +68,14 @@ typedef struct { IUnknown *impl; } ConnectionPointContainer; +typedef struct { + const IHlinkFrameVtbl *lpIHlinkFrameVtbl; + const ITargetFrame2Vtbl *lpITargetFrame2Vtbl; + + IUnknown *outer; + DocHost *doc_host; +} HlinkFrame; + struct _task_header_t; typedef void (*task_proc_t)(DocHost*, struct _task_header_t*); @@ -74,6 +84,14 @@ typedef struct _task_header_t { task_proc_t proc; } task_header_t; +typedef struct _IDocHostContainerVtbl +{ + void (WINAPI* GetDocObjRect)(DocHost*,RECT*); + HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR); + void (WINAPI* SetURL)(DocHost*,LPCWSTR); + HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*); +} IDocHostContainerVtbl; + struct DocHost { const IOleClientSiteVtbl *lpOleClientSiteVtbl; const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl; @@ -97,6 +115,8 @@ struct DocHost { IOleDocumentView *view; IUnknown *doc_navigate; + const IDocHostContainerVtbl *container_vtbl; + HWND hwnd; HWND frame_hwnd; @@ -128,10 +148,9 @@ struct WebBrowser { const IViewObject2Vtbl *lpViewObjectVtbl; const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl; const IOleCommandTargetVtbl *lpOleCommandTargetVtbl; - const IHlinkFrameVtbl *lpHlinkFrameVtbl; - const ITargetFrame2Vtbl *lpITargetFrame2Vtbl; const IServiceProviderVtbl *lpServiceProviderVtbl; const IDataObjectVtbl *lpDataObjectVtbl; + HlinkFrame hlink_frame; LONG ref; @@ -166,10 +185,13 @@ struct WebBrowser { struct InternetExplorer { const IWebBrowser2Vtbl *lpWebBrowser2Vtbl; + HlinkFrame hlink_frame; LONG ref; HWND frame_hwnd; + HWND status_hwnd; + HMENU menu; DocHost doc_host; }; @@ -188,9 +210,7 @@ struct InternetExplorer { #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl); #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl) #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl) -#define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpHlinkFrameVtbl) #define DATAOBJECT(x) ((IDataObject*) &(x)->lpDataObjectVtbl) -#define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl) #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl) #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl) @@ -203,16 +223,18 @@ struct InternetExplorer { #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl) +#define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpIHlinkFrameVtbl) +#define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl) + void WebBrowser_OleObject_Init(WebBrowser*); void WebBrowser_ViewObject_Init(WebBrowser*); void WebBrowser_DataObject_Init(WebBrowser*); void WebBrowser_Persist_Init(WebBrowser*); void WebBrowser_ClassInfo_Init(WebBrowser*); -void WebBrowser_HlinkFrame_Init(WebBrowser*); void WebBrowser_OleObject_Destroy(WebBrowser*); -void DocHost_Init(DocHost*,IDispatch*); +void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*); void DocHost_ClientSite_Init(DocHost*); void DocHost_Frame_Init(DocHost*); void release_dochost_client(DocHost*); @@ -223,6 +245,9 @@ void DocHost_ClientSite_Release(DocHost*); void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*); void ConnectionPointContainer_Destroy(ConnectionPointContainer*); +void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*); +BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**); + HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**); HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**); @@ -247,7 +272,8 @@ HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**); HRESULT TaskbarList_Create(IUnknown*,REFIID,void**); -#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) +#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) +#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) /********************************************************************** * Dll lifetime tracking declaration for shdocvw.dll @@ -259,6 +285,7 @@ static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_r extern HINSTANCE shdocvw_hinstance; extern void register_iewindow_class(void); extern void unregister_iewindow_class(void); +extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR); HRESULT register_class_object(BOOL); HRESULT get_typeinfo(ITypeInfo**); diff --git a/reactos/dll/win32/shdocvw/shdocvw.rbuild b/reactos/dll/win32/shdocvw/shdocvw.rbuild index 47c57a97d25..c7b565269d2 100644 --- a/reactos/dll/win32/shdocvw/shdocvw.rbuild +++ b/reactos/dll/win32/shdocvw/shdocvw.rbuild @@ -12,6 +12,7 @@ uuid ntdll advapi32 + comctl32 user32 ole32 oleaut32 diff --git a/reactos/dll/win32/shdocvw/shdocvw.rc b/reactos/dll/win32/shdocvw/shdocvw.rc index e7276fff6c4..84549f24ac6 100644 --- a/reactos/dll/win32/shdocvw/shdocvw.rc +++ b/reactos/dll/win32/shdocvw/shdocvw.rc @@ -34,4 +34,22 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: shdocvw.inf */ REGINST REGINST shdocvw.inf +/* @makedep: ietoolbar.bmp */ +IDB_IETOOLBAR BITMAP ietoolbar.bmp + +#include "De.rc" #include "En.rc" +#include "Es.rc" +#include "Fr.rc" +#include "He.rc" +#include "It.rc" +#include "Ko.rc" +#include "Lt.rc" +#include "Nl.rc" +//#include "Pl.rc" +#include "Pt.rc" +#include "Ro.rc" +#include "Si.rc" +#include "Sr.rc" +#include "Sv.rc" +#include "Uk.rc" diff --git a/reactos/dll/win32/shdocvw/shdocvw.spec b/reactos/dll/win32/shdocvw/shdocvw.spec index 4a0dd2c678a..be59d85c06b 100644 --- a/reactos/dll/win32/shdocvw/shdocvw.spec +++ b/reactos/dll/win32/shdocvw/shdocvw.spec @@ -120,7 +120,7 @@ @ stub HlinkFrameNavigateNHL @ stub IEAboutBox @ stub IEWriteErrorLog -@ stub ImportPrivacySettings +@ stdcall ImportPrivacySettings(wstr ptr ptr) @ stub InstallReg_RunDLL @ stdcall OpenURL(long long str long) @ stub SHGetIDispatchForFolder diff --git a/reactos/dll/win32/shdocvw/shdocvw_main.c b/reactos/dll/win32/shdocvw/shdocvw_main.c index 5dfd2b99ddf..a0070b489d4 100644 --- a/reactos/dll/win32/shdocvw/shdocvw_main.c +++ b/reactos/dll/win32/shdocvw/shdocvw_main.c @@ -218,14 +218,6 @@ DWORD WINAPI SetQueryNetSessionCount(DWORD arg) return 0; } -/********************************************************************** - * OpenURL (SHDOCVW.@) - */ -void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd) -{ - FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(lpcstrUrl), nShowCmd); -} - /********************************************************************** * Some forwards (by ordinal) to SHLWAPI */ @@ -461,3 +453,35 @@ DWORD WINAPI SHRestricted2A(DWORD restriction, LPCSTR url, DWORD reserved) heap_free(urlW); return res; } + +/****************************************************************** + * ImportPrivacySettings (SHDOCVW.@) + * + * Import global and/or per site privacy preferences from an xml file + * + * PARAMS + * filename [I] XML file to use + * pGlobalPrefs [IO] PTR to a usage flag for the global privacy preferences + * pPerSitePrefs [IO] PTR to a usage flag for the per site privacy preferences + * + * RETURNS + * Success: TRUE (the privacy preferences where updated) + * Failure: FALSE (the privacy preferences are unchanged) + * + * NOTES + * Set the flag to TRUE, when the related privacy preferences in the xml file + * should be used (parsed and overwrite the current settings). + * On return, the flag is TRUE, when the related privacy settings where used + * + */ +BOOL WINAPI ImportPrivacySettings(LPCWSTR filename, BOOL *pGlobalPrefs, BOOL * pPerSitePrefs) +{ + FIXME("(%s, %p->%d, %p->%d): stub\n", debugstr_w(filename), + pGlobalPrefs, pGlobalPrefs ? *pGlobalPrefs : 0, + pPerSitePrefs, pPerSitePrefs ? *pPerSitePrefs : 0); + + if (pGlobalPrefs) *pGlobalPrefs = FALSE; + if (pPerSitePrefs) *pPerSitePrefs = FALSE; + + return TRUE; +} diff --git a/reactos/dll/win32/shdocvw/webbrowser.c b/reactos/dll/win32/shdocvw/webbrowser.c index 47996863785..ac45d858b45 100644 --- a/reactos/dll/win32/shdocvw/webbrowser.c +++ b/reactos/dll/win32/shdocvw/webbrowser.c @@ -100,12 +100,6 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) { TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv); *ppv = OLECMD(This); - }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) { - TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv); - *ppv = HLINKFRAME(This); - }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) { - TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv); - *ppv = TARGETFRAME2(This); }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { *ppv = SERVPROV(This); TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); @@ -133,6 +127,17 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) { TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv); return E_NOINTERFACE; + }else if(IsEqualGUID(&IID_IOleLink, riid)) { + TRACE("(%p)->(IID_IOleLink %p) returning NULL\n", This, ppv); + return E_NOINTERFACE; + }else if(IsEqualGUID(&IID_IMarshal, riid)) { + TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv); + return E_NOINTERFACE; + }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) { + TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv); + return E_NOINTERFACE; + }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) { + return S_OK; } if(*ppv) { @@ -1130,6 +1135,62 @@ static const IServiceProviderVtbl ServiceProviderVtbl = WebBrowser_IServiceProvider_QueryService }; +#define DOCHOST_THIS(iface) DEFINE_THIS2(WebBrowser,doc_host,iface) + +static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc) +{ + GetClientRect(This->frame_hwnd, rc); +} + +static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text) +{ + return E_NOTIMPL; +} + +static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url) +{ + +} + +static HRESULT DocHostContainer_exec(DocHost *doc_host, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in, + VARIANT *out) +{ + WebBrowser *This = DOCHOST_THIS(doc_host); + IOleCommandTarget *cmdtrg = NULL; + HRESULT hres; + + if(This->client) { + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg); + if(FAILED(hres)) + cmdtrg = NULL; + } + + if(!cmdtrg && This->container) { + hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (void**)&cmdtrg); + if(FAILED(hres)) + cmdtrg = NULL; + } + + if(!cmdtrg) + return S_OK; + + hres = IOleCommandTarget_Exec(cmdtrg, cmd_group, cmdid, execopt, in, out); + IOleCommandTarget_Release(cmdtrg); + if(FAILED(hres)) + FIXME("Exec failed\n"); + + return hres; +} + +#undef DOCHOST_THIS + +static const IDocHostContainerVtbl DocHostContainerVtbl = { + DocHostContainer_GetDocObjRect, + DocHostContainer_SetStatusText, + DocHostContainer_SetURL, + DocHostContainer_exec +}; + static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv) { WebBrowser *ret; @@ -1144,7 +1205,7 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi ret->ref = 1; ret->version = version; - DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret)); + DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret), &DocHostContainerVtbl); ret->visible = VARIANT_TRUE; ret->menu_bar = VARIANT_TRUE; @@ -1157,7 +1218,8 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi WebBrowser_DataObject_Init(ret); WebBrowser_Persist_Init(ret); WebBrowser_ClassInfo_Init(ret); - WebBrowser_HlinkFrame_Init(ret); + + HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)WEBBROWSER2(ret), &ret->doc_host); SHDOCVW_LockModule(); diff --git a/reactos/dll/win32/wtsapi32/wtsapi32.c b/reactos/dll/win32/wtsapi32/wtsapi32.c index ab35de4f2ea..604752aa297 100644 --- a/reactos/dll/win32/wtsapi32/wtsapi32.c +++ b/reactos/dll/win32/wtsapi32/wtsapi32.c @@ -141,6 +141,16 @@ void WINAPI WTSFreeMemory(PVOID pMemory) return; } +/************************************************************ + * WTSLogoffSession (WTSAPI32.@) + */ +BOOL WINAPI WTSLogoffSession(HANDLE hserver, DWORD session_id, BOOL bwait) +{ + FIXME("(%p, 0x%x, %d): stub\n", hserver, session_id, bwait); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + /************************************************************ * WTSOpenServerA (WTSAPI32.@) */ diff --git a/reactos/dll/win32/wtsapi32/wtsapi32.spec b/reactos/dll/win32/wtsapi32/wtsapi32.spec index 2be9df00c9d..f20bbe206b6 100644 --- a/reactos/dll/win32/wtsapi32/wtsapi32.spec +++ b/reactos/dll/win32/wtsapi32/wtsapi32.spec @@ -7,7 +7,7 @@ @ stdcall WTSEnumerateSessionsA(long long long ptr ptr) @ stdcall WTSEnumerateSessionsW(long long long ptr ptr) @ stdcall WTSFreeMemory(ptr) -@ stub WTSLogoffSession +@ stdcall WTSLogoffSession(ptr long long) @ stdcall WTSOpenServerA(ptr) @ stdcall WTSOpenServerW(ptr) @ stdcall WTSQuerySessionInformationA(long long long ptr ptr) From abf6a5bfd515f3ae3a5e8b3228e27a7754f084b6 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 19 Nov 2010 22:42:53 +0000 Subject: [PATCH 034/132] [NPFS] - Rename DEVICE_EXTENSION to NPFS_VCB. - Add a type variable to distinguish FCBs and CCBs for device, directory or pipe. - Attach an FCB to the VCB that represents the root directory of the file system and implement an open routine for the root directory. - Make NpfsWaitPipe work when it is called for the root directory. [KERNEL32] - Remove the old version of WaitNamedPipeW. This patch fixes the broken wait pipe code. It was written and tested on r49458 because later revisions do not work for me. svn path=/trunk/; revision=49646 --- reactos/dll/win32/kernel32/file/npipe.c | 101 +------------- reactos/drivers/filesystems/npfs/create.c | 159 ++++++++++++++++------ reactos/drivers/filesystems/npfs/finfo.c | 4 +- reactos/drivers/filesystems/npfs/fsctrl.c | 57 +++++++- reactos/drivers/filesystems/npfs/npfs.c | 33 +++-- reactos/drivers/filesystems/npfs/npfs.h | 34 ++++- reactos/drivers/filesystems/npfs/rw.c | 64 +++++---- 7 files changed, 253 insertions(+), 199 deletions(-) diff --git a/reactos/dll/win32/kernel32/file/npipe.c b/reactos/dll/win32/kernel32/file/npipe.c index 629b69b678f..7112ffbcbda 100644 --- a/reactos/dll/win32/kernel32/file/npipe.c +++ b/reactos/dll/win32/kernel32/file/npipe.c @@ -14,7 +14,7 @@ #include DEBUG_CHANNEL(kernel32file); -//#define USING_PROPER_NPFS_WAIT_SEMANTICS +#define USING_PROPER_NPFS_WAIT_SEMANTICS /* FUNCTIONS ****************************************************************/ @@ -264,16 +264,6 @@ WaitNamedPipeA(LPCSTR lpNamedPipeName, } -/* - * When NPFS will work properly, use this code instead. It is compatible with - * Microsoft's NPFS.SYS. The main difference is that: - * - This code actually respects the timeout instead of ignoring it! - * - This code validates and creates the proper names for both UNC and local pipes - * - On NT, you open the *root* pipe directory (either \DosDevices\Pipe or - * \DosDevices\Unc\Server\Pipe) and then send the pipe to wait on in the - * FILE_PIPE_WAIT_FOR_BUFFER structure. - */ -#ifdef USING_PROPER_NPFS_WAIT_SEMANTICS /* * @implemented */ @@ -458,95 +448,6 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, /* Success */ return TRUE; } -#else -/* - * @implemented - */ -BOOL -WINAPI -WaitNamedPipeW(LPCWSTR lpNamedPipeName, - DWORD nTimeOut) -{ - UNICODE_STRING NamedPipeName; - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - FILE_PIPE_WAIT_FOR_BUFFER WaitPipe; - HANDLE FileHandle; - IO_STATUS_BLOCK Iosb; - - if (RtlDosPathNameToNtPathName_U(lpNamedPipeName, - &NamedPipeName, - NULL, - NULL) == FALSE) - { - return FALSE; - } - - InitializeObjectAttributes(&ObjectAttributes, - &NamedPipeName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenFile(&FileHandle, - FILE_READ_ATTRIBUTES | SYNCHRONIZE, - &ObjectAttributes, - &Iosb, - FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - RtlFreeUnicodeString(&NamedPipeName); - return FALSE; - } - - /* Check what timeout we got */ - if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT) - { - /* Don't use a timeout */ - WaitPipe.TimeoutSpecified = FALSE; - } - else - { - /* Check if we should wait forever */ - if (nTimeOut == NMPWAIT_WAIT_FOREVER) - { - /* Set the max */ - WaitPipe.Timeout.LowPart = 0; - WaitPipe.Timeout.HighPart = 0x80000000; - } - else - { - /* Convert to NT format */ - WaitPipe.Timeout.QuadPart = UInt32x32To64(-10000, nTimeOut); - } - - /* In both cases, we do have a timeout */ - WaitPipe.TimeoutSpecified = TRUE; - } - - Status = NtFsControlFile(FileHandle, - NULL, - NULL, - NULL, - &Iosb, - FSCTL_PIPE_WAIT, - &WaitPipe, - sizeof(WaitPipe), - NULL, - 0); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - RtlFreeUnicodeString(&NamedPipeName); - return FALSE; - } - - RtlFreeUnicodeString(&NamedPipeName); - return TRUE; -} -#endif /* diff --git a/reactos/drivers/filesystems/npfs/create.c b/reactos/drivers/filesystems/npfs/create.c index bef462fb8d7..0462003f97e 100644 --- a/reactos/drivers/filesystems/npfs/create.c +++ b/reactos/drivers/filesystems/npfs/create.c @@ -15,15 +15,15 @@ /* FUNCTIONS *****************************************************************/ -static PNPFS_FCB -NpfsFindPipe(PNPFS_DEVICE_EXTENSION DeviceExt, +PNPFS_FCB +NpfsFindPipe(PNPFS_VCB Vcb, PUNICODE_STRING PipeName) { PLIST_ENTRY CurrentEntry; PNPFS_FCB Fcb; - CurrentEntry = DeviceExt->PipeListHead.Flink; - while (CurrentEntry != &DeviceExt->PipeListHead) + CurrentEntry = Vcb->PipeListHead.Flink; + while (CurrentEntry != &Vcb->PipeListHead) { Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, PipeListEntry); if (RtlCompareUnicodeString(PipeName, @@ -103,53 +103,95 @@ NpfsSignalAndRemoveListeningServerInstance(PNPFS_FCB Fcb, } +static VOID +NpfsOpenRootDirectory(PNPFS_FCB Fcb, + PFILE_OBJECT FileObject, + PIO_STATUS_BLOCK IoStatus) +{ + PNPFS_CCB Ccb; + + DPRINT("NpfsOpenRootDirectory()\n"); + + Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); + if (Ccb == NULL) + { + IoStatus->Status = STATUS_NO_MEMORY; + return; + } + + Ccb->Type = CCB_DIRECTORY; + Ccb->Fcb = Fcb; + + FileObject->FsContext = Fcb; + FileObject->FsContext2 = Ccb; + + IoStatus->Information = FILE_OPENED; + IoStatus->Status = STATUS_SUCCESS; + + return; +} + + NTSTATUS NTAPI NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PEXTENDED_IO_STACK_LOCATION IoStack; + PUNICODE_STRING FileName; PFILE_OBJECT FileObject; + PFILE_OBJECT RelatedFileObject; PNPFS_FCB Fcb; PNPFS_CCB ClientCcb; PNPFS_CCB ServerCcb = NULL; - PNPFS_DEVICE_EXTENSION DeviceExt; - BOOLEAN SpecialAccess; + PNPFS_VCB Vcb; ACCESS_MASK DesiredAccess; + NTSTATUS Status; DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp); - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp); FileObject = IoStack->FileObject; + RelatedFileObject = FileObject->RelatedFileObject; + FileName = &FileObject->FileName; DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess; + DPRINT("FileObject %p\n", FileObject); DPRINT("FileName %wZ\n", &FileObject->FileName); Irp->IoStatus.Information = 0; - SpecialAccess = ((DesiredAccess & SPECIFIC_RIGHTS_ALL) == FILE_READ_ATTRIBUTES); - if (SpecialAccess) + if (FileName->Length == 2 && FileName->Buffer[0] == L'\\' && RelatedFileObject == NULL) { - DPRINT("NpfsCreate() open client end for special use!\n"); + DPRINT("Open the root directory\n"); + + NpfsOpenRootDirectory(Vcb->RootFcb, + FileObject, + &Irp->IoStatus); + + Status = Irp->IoStatus.Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; } + /* * Step 1. Find the pipe we're trying to open. */ - KeLockMutex(&DeviceExt->PipeListLock); - Fcb = NpfsFindPipe(DeviceExt, + KeLockMutex(&Vcb->PipeListLock); + Fcb = NpfsFindPipe(Vcb, &FileObject->FileName); if (Fcb == NULL) { /* Not found, bail out with error. */ DPRINT("No pipe found!\n"); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); Irp->IoStatus.Status = STATUS_OBJECT_NAME_NOT_FOUND; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_OBJECT_NAME_NOT_FOUND; } - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); /* * Acquire the lock for CCB lists. From now on no modifications to the @@ -170,11 +212,13 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, return STATUS_NO_MEMORY; } + ClientCcb->Type = CCB_PIPE; ClientCcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread; ClientCcb->Fcb = Fcb; ClientCcb->PipeEnd = FILE_PIPE_CLIENT_END; ClientCcb->OtherSide = NULL; - ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; +// ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; + ClientCcb->PipeState = FILE_PIPE_DISCONNECTED_STATE; InitializeListHead(&ClientCcb->ReadRequestListHead); DPRINT("CCB: %p\n", ClientCcb); @@ -212,9 +256,10 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* * Step 3. Search for listening server CCB. */ - +/* if (!SpecialAccess) { +*/ /* * WARNING: Point of no return! Once we get the server CCB it's * possible that we completed a wait request and so we have to @@ -270,6 +315,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */ NpfsSignalAndRemoveListeningServerInstance(Fcb, ServerCcb); } +/* } else if (IsListEmpty(&Fcb->ServerCcbListHead)) { @@ -287,6 +333,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_UNSUCCESSFUL; } +*/ /* * Step 4. Add the client CCB to a list and connect it if possible. @@ -326,7 +373,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, { PEXTENDED_IO_STACK_LOCATION IoStack; PFILE_OBJECT FileObject; - PNPFS_DEVICE_EXTENSION DeviceExt; + PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB Ccb; PNAMED_PIPE_CREATE_PARAMETERS Buffer; @@ -334,7 +381,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, DPRINT("NpfsCreateNamedPipe(DeviceObject %p Irp %p)\n", DeviceObject, Irp); - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp); FileObject = IoStack->FileObject; DPRINT("FileObject %p\n", FileObject); @@ -360,13 +407,14 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, return STATUS_NO_MEMORY; } + Ccb->Type = CCB_PIPE; Ccb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread; - KeLockMutex(&DeviceExt->PipeListLock); + KeLockMutex(&Vcb->PipeListLock); /* * First search for existing Pipe with the same name. */ - Fcb = NpfsFindPipe(DeviceExt, + Fcb = NpfsFindPipe(Vcb, &FileObject->FileName); if (Fcb != NULL) { @@ -374,7 +422,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, * Found Pipe with the same name. Check if we are * allowed to use it. */ - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); if (Fcb->CurrentInstances >= Fcb->MaximumInstances) { @@ -402,7 +450,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); if (Fcb == NULL) { - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); ExFreePool(Ccb); Irp->IoStatus.Status = STATUS_NO_MEMORY; Irp->IoStatus.Information = 0; @@ -410,12 +458,14 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, return STATUS_NO_MEMORY; } + Fcb->Type = FCB_PIPE; + Fcb->Vcb = Vcb; Fcb->PipeName.Length = FileObject->FileName.Length; Fcb->PipeName.MaximumLength = Fcb->PipeName.Length + sizeof(UNICODE_NULL); Fcb->PipeName.Buffer = ExAllocatePool(NonPagedPool, Fcb->PipeName.MaximumLength); if (Fcb->PipeName.Buffer == NULL) { - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); ExFreePool(Fcb); ExFreePool(Ccb); Irp->IoStatus.Status = STATUS_NO_MEMORY; @@ -457,18 +507,18 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, { if (Buffer->InboundQuota == 0) { - Fcb->InboundQuota = DeviceExt->DefaultQuota; + Fcb->InboundQuota = Vcb->DefaultQuota; } else { Fcb->InboundQuota = PAGE_ROUND_UP(Buffer->InboundQuota); - if (Fcb->InboundQuota < DeviceExt->MinQuota) + if (Fcb->InboundQuota < Vcb->MinQuota) { - Fcb->InboundQuota = DeviceExt->MinQuota; + Fcb->InboundQuota = Vcb->MinQuota; } - else if (Fcb->InboundQuota > DeviceExt->MaxQuota) + else if (Fcb->InboundQuota > Vcb->MaxQuota) { - Fcb->InboundQuota = DeviceExt->MaxQuota; + Fcb->InboundQuota = Vcb->MaxQuota; } } } @@ -481,18 +531,18 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, { if (Buffer->OutboundQuota == 0) { - Fcb->OutboundQuota = DeviceExt->DefaultQuota; + Fcb->OutboundQuota = Vcb->DefaultQuota; } else { Fcb->OutboundQuota = PAGE_ROUND_UP(Buffer->OutboundQuota); - if (Fcb->OutboundQuota < DeviceExt->MinQuota) + if (Fcb->OutboundQuota < Vcb->MinQuota) { - Fcb->OutboundQuota = DeviceExt->MinQuota; + Fcb->OutboundQuota = Vcb->MinQuota; } - else if (Fcb->OutboundQuota > DeviceExt->MaxQuota) + else if (Fcb->OutboundQuota > Vcb->MaxQuota) { - Fcb->OutboundQuota = DeviceExt->MaxQuota; + Fcb->OutboundQuota = Vcb->MaxQuota; } } } @@ -501,8 +551,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, Fcb->OutboundQuota = 0; } - InsertTailList(&DeviceExt->PipeListHead, &Fcb->PipeListEntry); - KeUnlockMutex(&DeviceExt->PipeListLock); + InsertTailList(&Vcb->PipeListHead, &Fcb->PipeListEntry); + KeUnlockMutex(&Vcb->PipeListLock); } if (Fcb->InboundQuota) @@ -514,9 +564,9 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, if (NewPipe) { - KeLockMutex(&DeviceExt->PipeListLock); + KeLockMutex(&Vcb->PipeListLock); RemoveEntryList(&Fcb->PipeListEntry); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); RtlFreeUnicodeString(&Fcb->PipeName); ExFreePool(Fcb); } @@ -573,7 +623,7 @@ NTSTATUS NTAPI NpfsCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PNPFS_DEVICE_EXTENSION DeviceExt; + PNPFS_VCB Vcb; PIO_STACK_LOCATION IoStack; PFILE_OBJECT FileObject; PNPFS_CCB Ccb, OtherSide; @@ -583,7 +633,7 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, DPRINT("NpfsCleanup(DeviceObject %p Irp %p)\n", DeviceObject, Irp); IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; FileObject = IoStack->FileObject; Ccb = FileObject->FsContext2; @@ -596,6 +646,15 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, return STATUS_SUCCESS; } + if (Ccb->Type == CCB_DIRECTORY) + { + DPRINT("Cleanup the root directory!\n"); + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + DPRINT("CCB %p\n", Ccb); Fcb = Ccb->Fcb; @@ -708,9 +767,9 @@ NTSTATUS NTAPI NpfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PNPFS_DEVICE_EXTENSION DeviceExt; PIO_STACK_LOCATION IoStack; PFILE_OBJECT FileObject; + PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB Ccb; BOOLEAN Server; @@ -718,7 +777,7 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, DPRINT("NpfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp); IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; FileObject = IoStack->FileObject; Ccb = FileObject->FsContext2; @@ -731,6 +790,20 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, return STATUS_SUCCESS; } + if (Ccb->Type == CCB_DIRECTORY) + { + DPRINT("Closing the root directory!\n"); + + ExFreePool(Ccb); + FileObject->FsContext = NULL; + FileObject->FsContext2 = NULL; + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + DPRINT("CCB %p\n", Ccb); Fcb = Ccb->Fcb; @@ -771,9 +844,9 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, IsListEmpty(&Fcb->ClientCcbListHead)) { RtlFreeUnicodeString(&Fcb->PipeName); - KeLockMutex(&DeviceExt->PipeListLock); + KeLockMutex(&Vcb->PipeListLock); RemoveEntryList(&Fcb->PipeListEntry); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); ExFreePool(Fcb); FileObject->FsContext = NULL; } diff --git a/reactos/drivers/filesystems/npfs/finfo.c b/reactos/drivers/filesystems/npfs/finfo.c index fbb1d6090de..46c47c0acf1 100644 --- a/reactos/drivers/filesystems/npfs/finfo.c +++ b/reactos/drivers/filesystems/npfs/finfo.c @@ -214,7 +214,7 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject, PIO_STACK_LOCATION IoStack; FILE_INFORMATION_CLASS FileInformationClass; PFILE_OBJECT FileObject; - PNPFS_DEVICE_EXTENSION DeviceExtension; + PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB Ccb; PVOID SystemBuffer; @@ -225,7 +225,7 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject, IoStack = IoGetCurrentIrpStackLocation (Irp); FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass; - DeviceExtension = DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; FileObject = IoStack->FileObject; Ccb = (PNPFS_CCB)FileObject->FsContext2; Fcb = Ccb->Fcb; diff --git a/reactos/drivers/filesystems/npfs/fsctrl.c b/reactos/drivers/filesystems/npfs/fsctrl.c index 242102d0d75..c177969f850 100644 --- a/reactos/drivers/filesystems/npfs/fsctrl.c +++ b/reactos/drivers/filesystems/npfs/fsctrl.c @@ -293,23 +293,66 @@ NpfsWaitPipe(PIRP Irp, PNPFS_CCB Ccb) { PLIST_ENTRY current_entry; + PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB ServerCcb; PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; - NTSTATUS Status; LARGE_INTEGER TimeOut; + UNICODE_STRING PipeName; + NTSTATUS Status; DPRINT("NpfsWaitPipe\n"); WaitPipe = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer; - Fcb = Ccb->Fcb; - if (Ccb->PipeState != 0) + /* Fail, if the CCB does not represent the root directory */ + if (Ccb->Type != CCB_DIRECTORY) + return STATUS_ILLEGAL_FUNCTION; + + /* Calculate the pipe name length and allocate the buffer */ + PipeName.Length = WaitPipe->NameLength + sizeof(WCHAR); + PipeName.MaximumLength = PipeName.Length + sizeof(WCHAR); + PipeName.Buffer = ExAllocatePool(NonPagedPool, PipeName.MaximumLength); + if (PipeName.Buffer == NULL) { - DPRINT("Pipe is not in passive (waiting) state!\n"); - return STATUS_UNSUCCESSFUL; + DPRINT1("Could not allocate memory for the pipe name!\n"); + return STATUS_NO_MEMORY; } + /* Copy the pipe name into the buffer, prepend a backslash and append a 0 character */ + PipeName.Buffer[0] = L'\\'; + RtlCopyMemory(&PipeName.Buffer[1], + &WaitPipe->Name[0], + WaitPipe->NameLength); + PipeName.Buffer[PipeName.Length / sizeof(WCHAR)] = 0; + + DPRINT("Waiting for Pipe %wZ\n", &PipeName); + + /* Get the VCB */ + Vcb = Ccb->Fcb->Vcb; + + /* Lock the pipe list */ + KeLockMutex(&Vcb->PipeListLock); + + /* File a pipe with the given name */ + Fcb = NpfsFindPipe(Vcb, + &PipeName); + + /* Unlock the pipe list */ + KeUnlockMutex(&Vcb->PipeListLock); + + /* Release the pipe name buffer */ + ExFreePool(PipeName.Buffer); + + /* Fail if not pipe was found */ + if (Fcb == NULL) + { + DPRINT("No pipe found!\n", Fcb); + return STATUS_OBJECT_NAME_NOT_FOUND; + } + + DPRINT("Fcb %p\n", Fcb); + /* search for listening server */ current_entry = Fcb->ServerCcbListHead.Flink; while (current_entry != &Fcb->ServerCcbListHead) @@ -484,13 +527,13 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIO_STACK_LOCATION IoStack; PFILE_OBJECT FileObject; NTSTATUS Status; - PNPFS_DEVICE_EXTENSION DeviceExt; + PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB Ccb; DPRINT("NpfsFileSystemContol(DeviceObject %p Irp %p)\n", DeviceObject, Irp); - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; IoStack = IoGetCurrentIrpStackLocation(Irp); DPRINT("IoStack: %p\n", IoStack); FileObject = IoStack->FileObject; diff --git a/reactos/drivers/filesystems/npfs/npfs.c b/reactos/drivers/filesystems/npfs/npfs.c index 147f4107b52..825abe3e21e 100644 --- a/reactos/drivers/filesystems/npfs/npfs.c +++ b/reactos/drivers/filesystems/npfs/npfs.c @@ -19,9 +19,10 @@ NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { - PNPFS_DEVICE_EXTENSION DeviceExtension; PDEVICE_OBJECT DeviceObject; UNICODE_STRING DeviceName; + PNPFS_VCB Vcb; + PNPFS_FCB Fcb; NTSTATUS Status; DPRINT("Named Pipe FSD 0.0.2\n"); @@ -56,7 +57,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe"); Status = IoCreateDevice(DriverObject, - sizeof(NPFS_DEVICE_EXTENSION), + sizeof(NPFS_VCB), &DeviceName, FILE_DEVICE_NAMED_PIPE, 0, @@ -68,21 +69,29 @@ DriverEntry(PDRIVER_OBJECT DriverObject, return Status; } - /* initialize the device object */ + /* Initialize the device object */ DeviceObject->Flags |= DO_DIRECT_IO; DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; - /* initialize the device extension */ - DeviceExtension = DeviceObject->DeviceExtension; - InitializeListHead(&DeviceExtension->PipeListHead); - InitializeListHead(&DeviceExtension->ThreadListHead); - KeInitializeMutex(&DeviceExtension->PipeListLock, 0); - DeviceExtension->EmptyWaiterCount = 0; + /* Initialize the Volume Control Block (VCB) */ + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; + InitializeListHead(&Vcb->PipeListHead); + InitializeListHead(&Vcb->ThreadListHead); + KeInitializeMutex(&Vcb->PipeListLock, 0); + Vcb->EmptyWaiterCount = 0; /* set the size quotas */ - DeviceExtension->MinQuota = PAGE_SIZE; - DeviceExtension->DefaultQuota = 8 * PAGE_SIZE; - DeviceExtension->MaxQuota = 64 * PAGE_SIZE; + Vcb->MinQuota = PAGE_SIZE; + Vcb->DefaultQuota = 8 * PAGE_SIZE; + Vcb->MaxQuota = 64 * PAGE_SIZE; + + Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); + Fcb->Type = FCB_DIRECTORY; + Fcb->Vcb = Vcb; + + + + Vcb->RootFcb = Fcb; return STATUS_SUCCESS; } diff --git a/reactos/drivers/filesystems/npfs/npfs.h b/reactos/drivers/filesystems/npfs/npfs.h index 373980ce6d5..cb37cb0564d 100644 --- a/reactos/drivers/filesystems/npfs/npfs.h +++ b/reactos/drivers/filesystems/npfs/npfs.h @@ -4,7 +4,22 @@ #include #include -typedef struct _NPFS_DEVICE_EXTENSION +typedef enum _FCB_TYPE +{ + FCB_DEVICE, + FCB_DIRECTORY, + FCB_PIPE +} FCB_TYPE; + +typedef enum _CCB_TYPE +{ + CCB_DEVICE, + CCB_DIRECTORY, + CCB_PIPE +} CCB_TYPE; + +/* Volume Control Block (VCB) aka Device Extension */ +typedef struct _NPFS_VCB { LIST_ENTRY PipeListHead; LIST_ENTRY ThreadListHead; @@ -13,11 +28,13 @@ typedef struct _NPFS_DEVICE_EXTENSION ULONG MinQuota; ULONG DefaultQuota; ULONG MaxQuota; -} NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION; + struct _NPFS_FCB *RootFcb; +} NPFS_VCB, *PNPFS_VCB; typedef struct _NPFS_FCB { - FSRTL_COMMON_FCB_HEADER RFCB; + FCB_TYPE Type; + PNPFS_VCB Vcb; UNICODE_STRING PipeName; LIST_ENTRY PipeListEntry; KMUTEX CcbListLock; @@ -40,9 +57,11 @@ typedef struct _NPFS_FCB typedef struct _NPFS_CCB { LIST_ENTRY CcbListEntry; + CCB_TYPE Type; + PNPFS_FCB Fcb; + struct _NPFS_CCB* OtherSide; struct ETHREAD *Thread; - PNPFS_FCB Fcb; KEVENT ConnectEvent; KEVENT ReadEvent; KEVENT WriteEvent; @@ -71,7 +90,7 @@ typedef struct _NPFS_THREAD_CONTEXT { ULONG Count; KEVENT Event; - PNPFS_DEVICE_EXTENSION DeviceExt; + PNPFS_VCB Vcb; LIST_ENTRY ListEntry; PVOID WaitObjectArray[MAXIMUM_WAIT_OBJECTS]; KWAIT_BLOCK WaitBlockArray[MAXIMUM_WAIT_OBJECTS]; @@ -135,4 +154,9 @@ NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath); +PNPFS_FCB +NpfsFindPipe(PNPFS_VCB Vcb, + PUNICODE_STRING PipeName); + + #endif /* __DRIVERS_FS_NP_NPFS_H */ diff --git a/reactos/drivers/filesystems/npfs/rw.c b/reactos/drivers/filesystems/npfs/rw.c index e5ef963b9ad..3c54bd7df47 100644 --- a/reactos/drivers/filesystems/npfs/rw.c +++ b/reactos/drivers/filesystems/npfs/rw.c @@ -48,8 +48,8 @@ NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PNPFS_CONTEXT Context; - PNPFS_DEVICE_EXTENSION DeviceExt; PIO_STACK_LOCATION IoStack; + PNPFS_VCB Vcb; PNPFS_CCB Ccb; PLIST_ENTRY ListEntry; PNPFS_THREAD_CONTEXT ThreadContext; @@ -60,17 +60,17 @@ NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject, IoReleaseCancelSpinLock(Irp->CancelIrql); Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext; - DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; IoStack = IoGetCurrentIrpStackLocation(Irp); Ccb = IoStack->FileObject->FsContext2; - KeLockMutex(&DeviceExt->PipeListLock); + KeLockMutex(&Vcb->PipeListLock); ExAcquireFastMutex(&Ccb->DataListLock); switch(IoStack->MajorFunction) { case IRP_MJ_READ: - ListEntry = DeviceExt->ThreadListHead.Flink; - while (ListEntry != &DeviceExt->ThreadListHead) + ListEntry = Vcb->ThreadListHead.Flink; + while (ListEntry != &Vcb->ThreadListHead) { ThreadContext = CONTAINING_RECORD(ListEntry, NPFS_THREAD_CONTEXT, ListEntry); /* Real events start at index 1 */ @@ -92,7 +92,7 @@ NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject, KeSetEvent(&ThreadContext->Event, IO_NO_INCREMENT, FALSE); ExReleaseFastMutex(&Ccb->DataListLock); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); return; } @@ -103,7 +103,7 @@ NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject, RemoveEntryList(&Context->ListEntry); ExReleaseFastMutex(&Ccb->DataListLock); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); Irp->IoStatus.Status = STATUS_CANCELLED; Irp->IoStatus.Information = 0; @@ -126,12 +126,12 @@ NpfsWaiterThread(PVOID InitContext) PIO_STACK_LOCATION IoStack = NULL; KIRQL OldIrql; - KeLockMutex(&ThreadContext->DeviceExt->PipeListLock); + KeLockMutex(&ThreadContext->Vcb->PipeListLock); while (1) { CurrentCount = ThreadContext->Count; - KeUnlockMutex(&ThreadContext->DeviceExt->PipeListLock); + KeUnlockMutex(&ThreadContext->Vcb->PipeListLock); IoAcquireCancelSpinLock(&OldIrql); if (Irp && IoSetCancelRoutine(Irp, NULL) != NULL) { @@ -162,14 +162,14 @@ NpfsWaiterThread(PVOID InitContext) { ASSERT(FALSE); } - KeLockMutex(&ThreadContext->DeviceExt->PipeListLock); + KeLockMutex(&ThreadContext->Vcb->PipeListLock); Count = Status - STATUS_WAIT_0; ASSERT (Count < CurrentCount); if (Count > 0) { Irp = ThreadContext->WaitIrpArray[Count]; ThreadContext->Count--; - ThreadContext->DeviceExt->EmptyWaiterCount++; + ThreadContext->Vcb->EmptyWaiterCount++; ThreadContext->WaitObjectArray[Count] = ThreadContext->WaitObjectArray[ThreadContext->Count]; ThreadContext->WaitIrpArray[Count] = ThreadContext->WaitIrpArray[ThreadContext->Count]; } @@ -184,18 +184,18 @@ NpfsWaiterThread(PVOID InitContext) if (ThreadContext->WaitIrpArray[i] == NULL) { ThreadContext->Count--; - ThreadContext->DeviceExt->EmptyWaiterCount++; + ThreadContext->Vcb->EmptyWaiterCount++; ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count]; ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count]; } } } - if (ThreadContext->Count == 1 && ThreadContext->DeviceExt->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS) + if (ThreadContext->Count == 1 && ThreadContext->Vcb->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS) { /* it exist an other thread with empty wait slots, we can remove our thread from the list */ RemoveEntryList(&ThreadContext->ListEntry); - ThreadContext->DeviceExt->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1; - KeUnlockMutex(&ThreadContext->DeviceExt->PipeListLock); + ThreadContext->Vcb->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1; + KeUnlockMutex(&ThreadContext->Vcb->PipeListLock); break; } } @@ -208,19 +208,21 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, { PLIST_ENTRY ListEntry; PNPFS_THREAD_CONTEXT ThreadContext = NULL; - NTSTATUS Status; + PNPFS_CONTEXT Context; HANDLE hThread; + PNPFS_VCB Vcb; KIRQL oldIrql; + NTSTATUS Status; - PNPFS_CONTEXT Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext; - PNPFS_DEVICE_EXTENSION DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext; + Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension; DPRINT("NpfsAddWaitingReadWriteRequest(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); - KeLockMutex(&DeviceExt->PipeListLock); + KeLockMutex(&Vcb->PipeListLock); - ListEntry = DeviceExt->ThreadListHead.Flink; - while (ListEntry != &DeviceExt->ThreadListHead) + ListEntry = Vcb->ThreadListHead.Flink; + while (ListEntry != &Vcb->ThreadListHead) { ThreadContext = CONTAINING_RECORD(ListEntry, NPFS_THREAD_CONTEXT, ListEntry); if (ThreadContext->Count < MAXIMUM_WAIT_OBJECTS) @@ -229,20 +231,21 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, } ListEntry = ListEntry->Flink; } - if (ListEntry == &DeviceExt->ThreadListHead) + + if (ListEntry == &Vcb->ThreadListHead) { ThreadContext = ExAllocatePool(NonPagedPool, sizeof(NPFS_THREAD_CONTEXT)); if (ThreadContext == NULL) { - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); return STATUS_NO_MEMORY; } - ThreadContext->DeviceExt = DeviceExt; + + ThreadContext->Vcb = Vcb; KeInitializeEvent(&ThreadContext->Event, SynchronizationEvent, FALSE); ThreadContext->Count = 1; ThreadContext->WaitObjectArray[0] = &ThreadContext->Event; - DPRINT("Creating a new system thread for waiting read/write requests\n"); Status = PsCreateSystemThread(&hThread, @@ -255,11 +258,12 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, if (!NT_SUCCESS(Status)) { ExFreePool(ThreadContext); - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); return Status; } - InsertHeadList(&DeviceExt->ThreadListHead, &ThreadContext->ListEntry); - DeviceExt->EmptyWaiterCount += MAXIMUM_WAIT_OBJECTS - 1; + + InsertHeadList(&Vcb->ThreadListHead, &ThreadContext->ListEntry); + Vcb->EmptyWaiterCount += MAXIMUM_WAIT_OBJECTS - 1; } IoMarkIrpPending(Irp); @@ -276,11 +280,11 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, ThreadContext->WaitObjectArray[ThreadContext->Count] = Context->WaitEvent; ThreadContext->WaitIrpArray[ThreadContext->Count] = Irp; ThreadContext->Count++; - DeviceExt->EmptyWaiterCount--; + Vcb->EmptyWaiterCount--; KeSetEvent(&ThreadContext->Event, IO_NO_INCREMENT, FALSE); Status = STATUS_SUCCESS; } - KeUnlockMutex(&DeviceExt->PipeListLock); + KeUnlockMutex(&Vcb->PipeListLock); return Status; } From 5d81f0a584ddfc7fb27b05d3e1c78e56088e69f0 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 20 Nov 2010 04:24:44 +0000 Subject: [PATCH 035/132] [Wine32k|User32] - Implement client thread information for the beginning of QS flag support and signaling synchronization of messages. - Set and clear idle event when setting clearing masks. This fixed the idle foreground hook call from user mode. - Fixed wine ListBox and ReactOS ComboBox tests. Critical note: SendMessageA/W, when IsThreadHooked is used and any global hooks are affirmed, all messages are sent to Win32k and the result is, A to W and W to A mismatch via UMToKM. Fixing Global hook support exposed a critical bug in ReactOS message system. Enable the appropriate hooks will temporarily remedy this bug. - All patches are from a checked out revision from 49475. Upping ntuser.h, win32k and user32 to sync. svn path=/trunk/; revision=49653 --- reactos/dll/win32/user32/include/user32p.h | 2 +- reactos/dll/win32/user32/windows/hook.c | 10 +++--- reactos/dll/win32/user32/windows/message.c | 15 ++++---- reactos/include/reactos/win32k/ntuser.h | 1 - .../subsystems/win32/win32k/include/misc.h | 2 +- .../win32/win32k/include/msgqueue.h | 3 ++ .../subsystems/win32/win32k/main/dllmain.c | 6 +++- .../subsystems/win32/win32k/ntuser/desktop.c | 36 +++++++++++-------- .../subsystems/win32/win32k/ntuser/message.c | 17 +++++---- reactos/subsystems/win32/win32k/ntuser/misc.c | 10 +++--- .../subsystems/win32/win32k/ntuser/msgqueue.c | 10 ++++++ .../win32/win32k/ntuser/simplecall.c | 9 ++--- 12 files changed, 75 insertions(+), 46 deletions(-) diff --git a/reactos/dll/win32/user32/include/user32p.h b/reactos/dll/win32/user32/include/user32p.h index 7bcf68cf777..d000164a4d6 100644 --- a/reactos/dll/win32/user32/include/user32p.h +++ b/reactos/dll/win32/user32/include/user32p.h @@ -28,7 +28,7 @@ /* One/Two Param Functions */ #define NtUserMsqSetWakeMask(dwWaitMask) \ - (HANDLE)NtUserCallOneParam(dwWaitMask, ONEPARAM_ROUTINE_MSQSETWAKEMASK) + (HANDLE)NtUserCallOneParam(dwWaitMask, ONEPARAM_ROUTINE_GETINPUTEVENT) #define NtUserMsqClearWakeMask() \ NtUserCallNoParam(NOPARAM_ROUTINE_MSQCLEARWAKEMASK) diff --git a/reactos/dll/win32/user32/windows/hook.c b/reactos/dll/win32/user32/windows/hook.c index 7df8e25ba81..ff982eebcc6 100644 --- a/reactos/dll/win32/user32/windows/hook.c +++ b/reactos/dll/win32/user32/windows/hook.c @@ -19,8 +19,8 @@ /* * * PROJECT: ReactOS user32.dll - * FILE: lib/user32/windows/input.c - * PURPOSE: Input + * FILE: dll/win32/user32/windows/hook.c + * PURPOSE: Hooks * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * UPDATE HISTORY: * 09-05-2001 CSH Created @@ -155,7 +155,8 @@ CallMsgFilterA( int nCode) { MSG Msg; - if (NtCurrentTeb()->Win32ThreadInfo && IsThreadHooked(GetWin32ClientInfo())) + if ( NtCurrentTeb()->Win32ThreadInfo && + (ISITHOOKED(WH_MSGFILTER) || ISITHOOKED(WH_SYSMSGFILTER)) ) { if ( lpMsg->message & ~WM_MAXIMUM ) { @@ -179,7 +180,8 @@ CallMsgFilterW( int nCode) { MSG Msg; - if (NtCurrentTeb()->Win32ThreadInfo && IsThreadHooked(GetWin32ClientInfo())) + if ( NtCurrentTeb()->Win32ThreadInfo && + (ISITHOOKED(WH_MSGFILTER) || ISITHOOKED(WH_SYSMSGFILTER)) ) { if ( lpMsg->message & ~WM_MAXIMUM ) { diff --git a/reactos/dll/win32/user32/windows/message.c b/reactos/dll/win32/user32/windows/message.c index 2645c87f234..300bfc796cf 100644 --- a/reactos/dll/win32/user32/windows/message.c +++ b/reactos/dll/win32/user32/windows/message.c @@ -2066,14 +2066,16 @@ SendMessageW(HWND Wnd, { if ( Window != NULL && Window->head.pti == ti && - !IsThreadHooked(GetWin32ClientInfo()) && +// !IsThreadHooked(GetWin32ClientInfo()) && // Enable to test message system bug. + !ISITHOOKED(WH_CALLWNDPROC) && + !ISITHOOKED(WH_CALLWNDPROCRET) && !(Window->state & WNDS_SERVERSIDEWINDOWPROC) ) { /* NOTE: We can directly send messages to the window procedure if *all* the following conditions are met: * Window belongs to calling thread - * The calling thread is not being hooked + * The calling thread is not being hooked for CallWndProc * Not calling a server side proc: Desktop, Switch, ScrollBar, Menu, IconTitle, or hWndMessage */ @@ -2137,14 +2139,16 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { if ( Window != NULL && Window->head.pti == ti && - !IsThreadHooked(GetWin32ClientInfo()) && +// !IsThreadHooked(GetWin32ClientInfo()) && // Enable to test message system bug. + !ISITHOOKED(WH_CALLWNDPROC) && + !ISITHOOKED(WH_CALLWNDPROCRET) && !(Window->state & WNDS_SERVERSIDEWINDOWPROC) ) { /* NOTE: We can directly send messages to the window procedure if *all* the following conditions are met: * Window belongs to calling thread - * The calling thread is not being hooked + * The calling thread is not being hooked for CallWndProc * Not calling a server side proc: Desktop, Switch, ScrollBar, Menu, IconTitle, or hWndMessage */ @@ -2694,9 +2698,8 @@ USER_MESSAGE_PUMP_ADDRESSES gmph = {sizeof(USER_MESSAGE_PUMP_ADDRESSES), DWORD gfMessagePumpHook = 0; BOOL WINAPI IsInsideMessagePumpHook() -{ // Fixme: Need to fully implement this! FF uses this and polls it when Min/Max +{ // FF uses this and polls it when Min/Max PCLIENTTHREADINFO pcti = GetWin32ClientInfo()->pClientThreadInfo; -// FIXME("IIMPH %x\n",pcti); return (gfMessagePumpHook && pcti && (pcti->dwcPumpHook > 0)); } diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index 64071cb9066..5c4a335ec9f 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -3161,7 +3161,6 @@ typedef struct tagKMDDELPARAM #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0xfffe0008 #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0xfffe000e -#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0xfffe0027 #define ONEPARAM_ROUTINE_GETCURSORPOSITION 0xfffe0048 // use ONEPARAM_ or TWOPARAM routine ? #define TWOPARAM_ROUTINE_GETWINDOWRGNBOX 0xfffd0048 // user mode #define TWOPARAM_ROUTINE_GETWINDOWRGN 0xfffd0049 // user mode diff --git a/reactos/subsystems/win32/win32k/include/misc.h b/reactos/subsystems/win32/win32k/include/misc.h index cfe47888512..340e9ef252d 100644 --- a/reactos/subsystems/win32/win32k/include/misc.h +++ b/reactos/subsystems/win32/win32k/include/misc.h @@ -24,7 +24,7 @@ extern HGDIOBJ StockObjects[]; extern SHORT gusLanguageID; SHORT FASTCALL IntGdiGetLanguageID(VOID); -DWORD APIENTRY IntGetQueueStatus(BOOL ClearChanges); +DWORD APIENTRY IntGetQueueStatus(DWORD); VOID FASTCALL IntUserManualGuiCheck(LONG Check); PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *); VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID); diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 435671404df..621195ca562 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -275,4 +275,7 @@ MsqCalculateMessageTime(IN PLARGE_INTEGER TickCount) return (LONG)(TickCount->QuadPart * (KeQueryTimeIncrement() / 10000)); } +VOID FASTCALL IdlePing(VOID); +VOID FASTCALL IdlePong(VOID); + /* EOF */ diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 5ed49f112e8..d0bbae1b025 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -279,7 +279,6 @@ Win32kThreadCallback(struct _ETHREAD *Thread, { /* Attempt to startup client support which should have been initialized in IntSetThreadDesktop. */ PCLIENTINFO pci = (PCLIENTINFO)pTeb->Win32ClientInfo; Win32Thread->pClientInfo = pci; - pci->pClientThreadInfo = NULL; pci->ppi = Win32Thread->ppi; pci->fsHooks = Win32Thread->fsHooks; if (Win32Thread->KeyboardLayout) pci->hKL = Win32Thread->KeyboardLayout->hkl; @@ -291,6 +290,10 @@ Win32kThreadCallback(struct _ETHREAD *Thread, pci->pDeskInfo = (PVOID)((ULONG_PTR)Win32Thread->pDeskInfo - pci->ulClientDelta); } + if (Win32Thread->pcti && pci->pDeskInfo) + pci->pClientThreadInfo = (PVOID)((ULONG_PTR)Win32Thread->pcti - pci->ulClientDelta); + else + pci->pClientThreadInfo = NULL; } else { @@ -332,6 +335,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread, IntSetThreadDesktop(NULL, TRUE); + PsSetThreadWin32Thread(Thread, NULL); } diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index 91b5a53224a..138b322092f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -1835,7 +1835,6 @@ IntUnmapDesktopView(IN PDESKTOP DesktopObject) static NTSTATUS IntMapDesktopView(IN PDESKTOP DesktopObject) { - PTHREADINFO ti; PPROCESSINFO CurrentWin32Process; PW32HEAP_USER_MAPPING HeapMapping, *PrevLink; PVOID UserBase = NULL; @@ -1898,19 +1897,6 @@ IntMapDesktopView(IN PDESKTOP DesktopObject) ObReferenceObject(DesktopObject); - /* create a W32THREADINFO structure if not already done, or update it */ - ti = GetW32ThreadInfo(); - GetWin32ClientInfo()->ulClientDelta = DesktopHeapGetUserDelta(); - if (ti != NULL) - { - if (GetWin32ClientInfo()->pDeskInfo == NULL) - { - GetWin32ClientInfo()->pDeskInfo = - (PVOID)((ULONG_PTR)DesktopObject->pDeskInfo - - GetWin32ClientInfo()->ulClientDelta); - } - } - return STATUS_SUCCESS; } @@ -1922,6 +1908,7 @@ IntSetThreadDesktop(IN PDESKTOP DesktopObject, PTHREADINFO W32Thread; NTSTATUS Status; BOOL MapHeap; + CLIENTTHREADINFO ctiSave; DPRINT("IntSetThreadDesktop() DO=%p, FOF=%d\n", DesktopObject, FreeOnFailure); MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess); @@ -1948,9 +1935,27 @@ IntSetThreadDesktop(IN PDESKTOP DesktopObject, SetLastNtError(Status); return FALSE; } + W32Thread->pDeskInfo = DesktopObject->pDeskInfo; + } + + RtlZeroMemory(&ctiSave, sizeof(CLIENTTHREADINFO)); + + if (W32Thread->pcti && OldDesktop) + { + RtlCopyMemory(&ctiSave, W32Thread->pcti, sizeof(CLIENTTHREADINFO)); + DPRINT("Free ClientThreadInfo\n"); + DesktopHeapFree(OldDesktop, W32Thread->pcti); + W32Thread->pcti = NULL; + } + + if (!W32Thread->pcti && DesktopObject) + { + DPRINT("Allocate ClientThreadInfo\n"); + W32Thread->pcti = DesktopHeapAlloc( DesktopObject, + sizeof(CLIENTTHREADINFO)); + RtlCopyMemory(W32Thread->pcti, &ctiSave, sizeof(CLIENTTHREADINFO)); } - /* Hack for system threads */ if (NtCurrentTeb()) { PCLIENTINFO pci = GetWin32ClientInfo(); @@ -1958,6 +1963,7 @@ IntSetThreadDesktop(IN PDESKTOP DesktopObject, if (DesktopObject) { pci->pDeskInfo = (PVOID)((ULONG_PTR)DesktopObject->pDeskInfo - pci->ulClientDelta); + if (W32Thread->pcti) pci->pClientThreadInfo = (PVOID)((ULONG_PTR)W32Thread->pcti - pci->ulClientDelta); } } diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 833e149cb95..8cabf9fbdf2 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -1901,7 +1901,7 @@ UserSendNotifyMessage( HWND hWnd, DWORD APIENTRY -IntGetQueueStatus(BOOL ClearChanges) +IntGetQueueStatus(DWORD Changes) { PTHREADINFO pti; PUSER_MESSAGE_QUEUE Queue; @@ -1909,13 +1909,19 @@ IntGetQueueStatus(BOOL ClearChanges) pti = PsGetCurrentThreadWin32Thread(); Queue = pti->MessageQueue; +// wine: + Changes &= (QS_ALLINPUT|QS_ALLPOSTMESSAGE|QS_SMRESULT); - Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits); - if (ClearChanges) + Result = MAKELONG(Queue->ChangedBits & Changes, Queue->QueueBits & Changes); + + if (pti->pcti) { - Queue->ChangedBits = 0; + pti->pcti->fsChangeBits = Queue->ChangedBits; + pti->pcti->fsChangeBits &= ~Changes; } + Queue->ChangedBits &= ~Changes; + return Result; } @@ -2089,7 +2095,6 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, { NTUSERGETMESSAGEINFO Info; NTSTATUS Status; - /* FIXME: if initialization is removed, gcc complains that this may be used before initialization. Please review */ PMSGMEMORY MsgMemoryEntry; PVOID UserMem; ULONG Size; @@ -2110,7 +2115,7 @@ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo, UserLeave(); - Info.Msg = Msg; //.Msg; + Info.Msg = Msg; /* See if this message type is present in the table */ MsgMemoryEntry = FindMsgMemory(Info.Msg.message); diff --git a/reactos/subsystems/win32/win32k/ntuser/misc.c b/reactos/subsystems/win32/win32k/ntuser/misc.c index 48ef50b7ae6..d884d0c145f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/misc.c +++ b/reactos/subsystems/win32/win32k/ntuser/misc.c @@ -125,7 +125,7 @@ NtUserGetThreadState( break; case THREADSTATE_GETINPUTSTATE: - ret = HIWORD(IntGetQueueStatus(FALSE)) & (QS_KEY | QS_MOUSEBUTTON); + ret = LOWORD(IntGetQueueStatus(QS_POSTMESSAGE|QS_TIMER|QS_PAINT|QS_SENDMESSAGE|QS_INPUT)) & (QS_KEY | QS_MOUSEBUTTON); break; } @@ -472,8 +472,6 @@ GetW32ThreadInfo(VOID) /* initialize it */ pti->ppi = ppi = GetW32ProcessInfo(); - pti->pcti = &pti->cti; // FIXME Need to set it in desktop.c! - if (pti->rpdesk != NULL) { pti->pDeskInfo = pti->rpdesk->pDeskInfo; @@ -494,7 +492,6 @@ GetW32ThreadInfo(VOID) Teb->Win32ThreadInfo = (PW32THREAD) pti; - pci->pClientThreadInfo = NULL; // FIXME Need to set it in desktop.c! pci->ppi = ppi; pci->fsHooks = pti->fsHooks; if (pti->KeyboardLayout) pci->hKL = pti->KeyboardLayout->hkl; @@ -506,6 +503,11 @@ GetW32ThreadInfo(VOID) pci->pDeskInfo = (PVOID)((ULONG_PTR)pti->pDeskInfo - pci->ulClientDelta); } + if (pti->pcti && pci->pDeskInfo) + pci->pClientThreadInfo = (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta); + else + pci->pClientThreadInfo = NULL; + } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index d501aa1f5fe..f705aed4e2a 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -77,6 +77,11 @@ IntMsqSetWakeMask(DWORD WakeMask) MessageQueue->WakeMask = WakeMask; MessageEventHandle = MessageQueue->NewMessagesHandle; + if (Win32Thread->pcti) + Win32Thread->pcti->fsWakeMask = WakeMask; + + IdlePing(); + return MessageEventHandle; } @@ -94,6 +99,11 @@ IntMsqClearWakeMask(VOID) // HACK!!!!!!! Newbies that wrote this should hold your head down in shame! (jt) MessageQueue->WakeMask = ~0; + if (Win32Thread->pcti) + Win32Thread->pcti->fsWakeMask = 0; + + IdlePong(); + return TRUE; } diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index 29d35958e44..953f936574a 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -252,7 +252,7 @@ NtUserCallOneParam( RETURN( FALSE); } - case ONEPARAM_ROUTINE_MSQSETWAKEMASK: + case ONEPARAM_ROUTINE_GETINPUTEVENT: RETURN( (DWORD_PTR)IntMsqSetWakeMask(Param)); case ONEPARAM_ROUTINE_GETKEYBOARDTYPE: @@ -269,12 +269,7 @@ NtUserCallOneParam( case ONEPARAM_ROUTINE_GETQUEUESTATUS: { - DWORD Ret; - WORD changed_bits, wake_bits; - Ret = IntGetQueueStatus(FALSE); - changed_bits = LOWORD(Ret); - wake_bits = HIWORD(Ret); - RETURN( MAKELONG(changed_bits & Param, wake_bits & Param)); + RETURN (IntGetQueueStatus((DWORD)Param)); } case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS: /* FIXME: Should use UserEnterShared */ From 40232d377b14988a9d6a75b0eebed71d4245f6e1 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 20 Nov 2010 10:22:36 +0000 Subject: [PATCH 036/132] [NTOSKRNL/PPC] Fix index out of bounds svn path=/trunk/; revision=49654 --- reactos/ntoskrnl/config/powerpc/cmhardwr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/config/powerpc/cmhardwr.c b/reactos/ntoskrnl/config/powerpc/cmhardwr.c index a14d90a26e0..f620f736109 100644 --- a/reactos/ntoskrnl/config/powerpc/cmhardwr.c +++ b/reactos/ntoskrnl/config/powerpc/cmhardwr.c @@ -446,7 +446,7 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc } /* Null-terminate it */ - CpuString[48] = ANSI_NULL; + CpuString[47] = ANSI_NULL; } } From bb5c7012d3ec4692529a38eda7033a9503991e4d Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sat, 20 Nov 2010 11:24:17 +0000 Subject: [PATCH 037/132] - Add wer.dll from Wine 1.3.7 - Sync gdiplus with Wine 1.3.7 svn path=/trunk/; revision=49658 --- reactos/boot/bootdata/packages/reactos.dff | 1 + reactos/dll/win32/gdiplus/brush.c | 110 +++++- reactos/dll/win32/gdiplus/font.c | 8 +- reactos/dll/win32/gdiplus/gdiplus.c | 18 +- reactos/dll/win32/gdiplus/gdiplus.spec | 54 +-- reactos/dll/win32/gdiplus/gdiplus_private.h | 11 +- reactos/dll/win32/gdiplus/graphics.c | 360 +++++++++++++++++++- reactos/dll/win32/gdiplus/graphicspath.c | 8 +- reactos/dll/win32/gdiplus/image.c | 181 ++++++---- reactos/dll/win32/gdiplus/pen.c | 60 ++++ reactos/dll/win32/gdiplus/region.c | 218 +++++++++++- reactos/dll/win32/wer/main.c | 321 +++++++++++++++++ reactos/dll/win32/wer/wer.rbuild | 11 + reactos/dll/win32/wer/wer.spec | 77 +++++ reactos/dll/win32/win32.rbuild | 3 + reactos/include/psdk/werapi.h | 127 +++++++ reactos/media/doc/README.WINE | 1 + 17 files changed, 1455 insertions(+), 114 deletions(-) create mode 100644 reactos/dll/win32/wer/main.c create mode 100644 reactos/dll/win32/wer/wer.rbuild create mode 100644 reactos/dll/win32/wer/wer.spec create mode 100644 reactos/include/psdk/werapi.h diff --git a/reactos/boot/bootdata/packages/reactos.dff b/reactos/boot/bootdata/packages/reactos.dff index c5e998d4b36..f08fb2489c0 100644 --- a/reactos/boot/bootdata/packages/reactos.dff +++ b/reactos/boot/bootdata/packages/reactos.dff @@ -456,6 +456,7 @@ dll\win32\uxtheme\uxtheme.dll 1 dll\win32\vdmdbg\vdmdbg.dll 1 dll\win32\version\version.dll 1 dll\win32\wdmaud.drv\wdmaud.drv 1 +dll\win32\wer\wer.dll 1 dll\win32\windowscodecs\windowscodecs.dll 1 dll\win32\winemp3.acm\winemp3.acm 1 dll\win32\winfax\winfax.dll 1 diff --git a/reactos/dll/win32/gdiplus/brush.c b/reactos/dll/win32/gdiplus/brush.c index b46bdc559b8..74dc833d88d 100644 --- a/reactos/dll/win32/gdiplus/brush.c +++ b/reactos/dll/win32/gdiplus/brush.c @@ -352,6 +352,9 @@ GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint, if(!line || !startpoint || !endpoint || wrap == WrapModeClamp) return InvalidParameter; + if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y) + return OutOfMemory; + *line = GdipAlloc(sizeof(GpLineGradient)); if(!*line) return OutOfMemory; @@ -428,7 +431,7 @@ GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* startpoint, stF.X = (REAL)startpoint->X; stF.Y = (REAL)startpoint->Y; endF.X = (REAL)endpoint->X; - endF.X = (REAL)endpoint->Y; + endF.Y = (REAL)endpoint->Y; return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line); } @@ -1494,6 +1497,19 @@ GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST RE return NotImplemented; } +GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush, + REAL focus, REAL scale) +{ + static int calls; + + TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count) { @@ -1501,6 +1517,20 @@ GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush, return NotImplemented; } +GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush, + ARGB *blend, REAL *pos, INT count) +{ + FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count); + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, + INT *count) +{ + FIXME("(%p,%p): stub\n", brush, count); + return NotImplemented; +} + GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad, ARGB argb) { @@ -1621,6 +1651,84 @@ GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad, return Ok; } +GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad, + GpMatrix *matrix) +{ + static int calls; + + TRACE("(%p,%p)\n", grad, matrix); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad, + GpMatrix *matrix) +{ + static int calls; + + TRACE("(%p,%p)\n", grad, matrix); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad, + GDIPCONST GpMatrix *matrix, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%p,%i)\n", grad, matrix, order); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad, + REAL angle, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%0.2f,%i)\n", grad, angle, order); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad, + REAL sx, REAL sy, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad, + REAL dx, REAL dy, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb) { TRACE("(%p, %x)\n", sf, argb); diff --git a/reactos/dll/win32/gdiplus/font.c b/reactos/dll/win32/gdiplus/font.c index 2670e8175dc..843cfb52683 100644 --- a/reactos/dll/win32/gdiplus/font.c +++ b/reactos/dll/win32/gdiplus/font.c @@ -452,12 +452,16 @@ GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height) { REAL dpi; + GpStatus stat; TRACE("%p %p %p\n", font, graphics, height); - dpi = GetDeviceCaps(graphics->hdc, LOGPIXELSY); + stat = GdipGetDpiY((GpGraphics*)graphics, &dpi); - return GdipGetFontHeightGivenDPI(font, dpi, height); + if (stat == Ok) + stat = GdipGetFontHeightGivenDPI(font, dpi, height); + + return stat; } /******************************************************************************* diff --git a/reactos/dll/win32/gdiplus/gdiplus.c b/reactos/dll/win32/gdiplus/gdiplus.c index 383f53621fb..fb159be55b2 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.c +++ b/reactos/dll/win32/gdiplus/gdiplus.c @@ -121,6 +121,14 @@ void WINAPI GdiplusShutdown(ULONG_PTR token) /* FIXME: no object tracking */ } +/* "bricksntiles" expects a return value of 0, which native coincidentally gives */ +ULONG WINAPI GdiplusShutdown_wrapper(ULONG_PTR token) +{ + GdiplusShutdown(token); + + return 0; +} + /***************************************************** * GdipAlloc [GDIPLUS.@] */ @@ -314,18 +322,18 @@ GpStatus hresult_to_status(HRESULT res) } /* converts a given unit to its value in pixels */ -REAL convert_unit(HDC hdc, GpUnit unit) +REAL convert_unit(REAL logpixels, GpUnit unit) { switch(unit) { case UnitInch: - return (REAL) GetDeviceCaps(hdc, LOGPIXELSX); + return logpixels; case UnitPoint: - return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 72.0; + return logpixels / 72.0; case UnitDocument: - return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 300.0; + return logpixels / 300.0; case UnitMillimeter: - return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 25.4; + return logpixels / 25.4; case UnitWorld: ERR("cannot convert UnitWorld\n"); return 0.0; diff --git a/reactos/dll/win32/gdiplus/gdiplus.spec b/reactos/dll/win32/gdiplus/gdiplus.spec index bf0de649289..4cf15ab4d5e 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.spec +++ b/reactos/dll/win32/gdiplus/gdiplus.spec @@ -67,7 +67,7 @@ @ stdcall GdipCombineRegionRegion(ptr ptr long) @ stdcall GdipComment(ptr long ptr) @ stdcall GdipConvertToEmfPlus(ptr ptr ptr long ptr ptr) -@ stub GdipConvertToEmfPlusToFile +@ stdcall GdipConvertToEmfPlusToFile(ptr ptr ptr ptr long ptr ptr) @ stub GdipConvertToEmfPlusToStream @ stdcall GdipCreateAdjustableArrowCap(long long long ptr) @ stub GdipCreateBitmapFromDirectDrawSurface @@ -215,8 +215,8 @@ @ stub GdipEnumerateMetafileSrcRectDestRectI @ stdcall GdipFillClosedCurve2(ptr ptr ptr long long long) @ stdcall GdipFillClosedCurve2I(ptr ptr ptr long long long) -@ stub GdipFillClosedCurve -@ stub GdipFillClosedCurveI +@ stdcall GdipFillClosedCurve(ptr ptr ptr long) +@ stdcall GdipFillClosedCurveI(ptr ptr ptr long) @ stdcall GdipFillEllipse(ptr ptr long long long long) @ stdcall GdipFillEllipseI(ptr ptr long long long long) @ stdcall GdipFillPath(ptr ptr ptr) @@ -315,10 +315,10 @@ @ stdcall GdipGetLogFontW(ptr ptr ptr) @ stdcall GdipGetMatrixElements(ptr ptr) @ stub GdipGetMetafileDownLevelRasterizationLimit -@ stub GdipGetMetafileHeaderFromEmf -@ stub GdipGetMetafileHeaderFromFile +@ stdcall GdipGetMetafileHeaderFromEmf(ptr ptr) +@ stdcall GdipGetMetafileHeaderFromFile(wstr ptr) @ stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr) -@ stub GdipGetMetafileHeaderFromStream +@ stdcall GdipGetMetafileHeaderFromStream(ptr ptr) @ stub GdipGetMetafileHeaderFromWmf @ stdcall GdipGetNearestColor(ptr ptr) @ stdcall GdipGetPageScale(ptr ptr) @@ -334,13 +334,13 @@ @ stdcall GdipGetPathGradientGammaCorrection(ptr ptr) @ stub GdipGetPathGradientPath @ stdcall GdipGetPathGradientPointCount(ptr ptr) -@ stub GdipGetPathGradientPresetBlend -@ stub GdipGetPathGradientPresetBlendCount +@ stdcall GdipGetPathGradientPresetBlend(ptr ptr ptr long) +@ stdcall GdipGetPathGradientPresetBlendCount(ptr ptr) @ stdcall GdipGetPathGradientRect(ptr ptr) @ stdcall GdipGetPathGradientRectI(ptr ptr) @ stdcall GdipGetPathGradientSurroundColorCount(ptr ptr) @ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr) -@ stub GdipGetPathGradientTransform +@ stdcall GdipGetPathGradientTransform(ptr ptr) @ stdcall GdipGetPathGradientWrapMode(ptr ptr) @ stdcall GdipGetPathLastPoint(ptr ptr) @ stdcall GdipGetPathPoints(ptr ptr long) @@ -351,7 +351,7 @@ @ stdcall GdipGetPenBrushFill(ptr ptr) @ stdcall GdipGetPenColor(ptr ptr) @ stub GdipGetPenCompoundArray -@ stub GdipGetPenCompoundCount +@ stdcall GdipGetPenCompoundCount(ptr ptr) @ stdcall GdipGetPenCustomEndCap(ptr ptr) @ stdcall GdipGetPenCustomStartCap(ptr ptr) @ stdcall GdipGetPenDashArray(ptr ptr long) @@ -365,7 +365,7 @@ @ stdcall GdipGetPenMiterLimit(ptr ptr) @ stdcall GdipGetPenMode(ptr ptr) @ stdcall GdipGetPenStartCap(ptr ptr) -@ stub GdipGetPenTransform +@ stdcall GdipGetPenTransform(ptr ptr) @ stdcall GdipGetPenUnit(ptr ptr) @ stdcall GdipGetPenWidth(ptr ptr) @ stdcall GdipGetPixelOffsetMode(ptr ptr) @@ -380,9 +380,9 @@ @ stdcall GdipGetRegionData(ptr ptr long ptr) @ stdcall GdipGetRegionDataSize(ptr ptr) @ stdcall GdipGetRegionHRgn(ptr ptr ptr) -@ stub GdipGetRegionScans +@ stdcall GdipGetRegionScans(ptr ptr ptr ptr) @ stdcall GdipGetRegionScansCount(ptr ptr ptr) -@ stub GdipGetRegionScansI +@ stdcall GdipGetRegionScansI(ptr ptr ptr ptr) @ stdcall GdipGetRenderingOrigin(ptr ptr ptr) @ stdcall GdipGetSmoothingMode(ptr ptr) @ stdcall GdipGetSolidFillColor(ptr ptr) @@ -444,8 +444,8 @@ @ stdcall GdipMeasureString(ptr wstr long ptr ptr ptr ptr ptr ptr) @ stdcall GdipMultiplyLineTransform(ptr ptr long) @ stdcall GdipMultiplyMatrix(ptr ptr long) -@ stub GdipMultiplyPathGradientTransform -@ stub GdipMultiplyPenTransform +@ stdcall GdipMultiplyPathGradientTransform(ptr ptr long) +@ stdcall GdipMultiplyPenTransform(ptr ptr long) @ stdcall GdipMultiplyTextureTransform(ptr ptr long) @ stdcall GdipMultiplyWorldTransform(ptr ptr long) @ stdcall GdipNewInstalledFontCollection(ptr) @@ -466,11 +466,11 @@ @ stub GdipPlayTSClientRecord @ stdcall GdipPrivateAddFontFile(ptr wstr) @ stdcall GdipPrivateAddMemoryFont(ptr ptr long) -@ stub GdipRecordMetafile +@ stdcall GdipRecordMetafile(long long ptr long wstr ptr) @ stdcall GdipRecordMetafileFileName(wstr long long ptr long wstr ptr) @ stdcall GdipRecordMetafileFileNameI(wstr long long ptr long wstr ptr) @ stdcall GdipRecordMetafileI(long long ptr long wstr ptr) -@ stub GdipRecordMetafileStream +@ stdcall GdipRecordMetafileStream(ptr long long ptr long wstr ptr) @ stub GdipRecordMetafileStreamI @ stdcall GdipReleaseDC(ptr ptr) @ stdcall GdipRemovePropertyItem(ptr long) @@ -487,8 +487,8 @@ @ stdcall GdipReversePath(ptr) @ stdcall GdipRotateLineTransform(ptr long long) @ stdcall GdipRotateMatrix(ptr long long) -@ stub GdipRotatePathGradientTransform -@ stub GdipRotatePenTransform +@ stdcall GdipRotatePathGradientTransform(ptr long long) +@ stdcall GdipRotatePenTransform(ptr long long) @ stdcall GdipRotateTextureTransform(ptr long long) @ stdcall GdipRotateWorldTransform(ptr long long) @ stub GdipSaveAdd @@ -498,7 +498,7 @@ @ stdcall GdipSaveImageToStream(ptr ptr ptr ptr) @ stdcall GdipScaleLineTransform(ptr long long long) @ stdcall GdipScaleMatrix(ptr long long long) -@ stub GdipScalePathGradientTransform +@ stdcall GdipScalePathGradientTransform(ptr long long long) @ stdcall GdipScalePenTransform(ptr long long long) @ stdcall GdipScaleTextureTransform(ptr long long long) @ stdcall GdipScaleWorldTransform(ptr long long long) @@ -554,12 +554,12 @@ @ stdcall GdipSetPathGradientCenterPointI(ptr ptr) @ stdcall GdipSetPathGradientFocusScales(ptr long long) @ stdcall GdipSetPathGradientGammaCorrection(ptr long) -@ stub GdipSetPathGradientLinearBlend +@ stdcall GdipSetPathGradientLinearBlend(ptr long long) @ stub GdipSetPathGradientPath @ stdcall GdipSetPathGradientPresetBlend(ptr ptr ptr long) @ stdcall GdipSetPathGradientSigmaBlend(ptr long long) @ stdcall GdipSetPathGradientSurroundColorsWithCount(ptr ptr ptr) -@ stub GdipSetPathGradientTransform +@ stdcall GdipSetPathGradientTransform(ptr ptr) @ stdcall GdipSetPathGradientWrapMode(ptr long) @ stdcall GdipSetPathMarker(ptr) @ stdcall GdipSetPenBrushFill(ptr ptr) @@ -577,7 +577,7 @@ @ stdcall GdipSetPenMiterLimit(ptr long) @ stdcall GdipSetPenMode(ptr long) @ stdcall GdipSetPenStartCap(ptr long) -@ stub GdipSetPenTransform +@ stdcall GdipSetPenTransform(ptr ptr) @ stub GdipSetPenUnit @ stdcall GdipSetPenWidth(ptr long) @ stdcall GdipSetPixelOffsetMode(ptr long) @@ -613,8 +613,8 @@ @ stdcall GdipTranslateClipI(ptr long long) @ stdcall GdipTranslateLineTransform(ptr long long long) @ stdcall GdipTranslateMatrix(ptr long long long) -@ stub GdipTranslatePathGradientTransform -@ stub GdipTranslatePenTransform +@ stdcall GdipTranslatePathGradientTransform(ptr long long long) +@ stdcall GdipTranslatePenTransform(ptr long long long) @ stdcall GdipTranslateRegion(ptr long long) @ stdcall GdipTranslateRegionI(ptr long long) @ stdcall GdipTranslateTextureTransform(ptr long long long) @@ -623,8 +623,8 @@ @ stdcall GdipVectorTransformMatrixPointsI(ptr ptr long) @ stdcall GdipWarpPath(ptr ptr ptr long long long long long long long) @ stdcall GdipWidenPath(ptr ptr ptr long) -@ stub GdipWindingModeOutline +@ stdcall GdipWindingModeOutline(ptr ptr long) @ stdcall GdiplusNotificationHook(ptr) @ stdcall GdiplusNotificationUnhook(ptr) -@ stdcall GdiplusShutdown(ptr) +@ stdcall GdiplusShutdown(ptr) GdiplusShutdown_wrapper @ stdcall GdiplusStartup(ptr ptr ptr) diff --git a/reactos/dll/win32/gdiplus/gdiplus_private.h b/reactos/dll/win32/gdiplus/gdiplus_private.h index eafed7c820e..b78e459a3ce 100644 --- a/reactos/dll/win32/gdiplus/gdiplus_private.h +++ b/reactos/dll/win32/gdiplus/gdiplus_private.h @@ -47,7 +47,9 @@ extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle); extern REAL gdiplus_atan2(REAL dy, REAL dx); extern GpStatus hresult_to_status(HRESULT res); -extern REAL convert_unit(HDC hdc, GpUnit unit); +extern REAL convert_unit(REAL logpixels, GpUnit unit); + +extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics); extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2); @@ -150,6 +152,12 @@ struct GpGraphics{ UINT textcontrast; /* not used yet. get/set only */ struct list containers; GraphicsContainer contid; /* last-issued container ID */ + /* For giving the caller an HDC when we technically can't: */ + HBITMAP temp_hbitmap; + int temp_hbitmap_width; + int temp_hbitmap_height; + BYTE *temp_bits; + HDC temp_hdc; }; struct GpBrush{ @@ -269,6 +277,7 @@ struct GpBitmap{ HDC hdc; BYTE *bits; /* actual image bits if this is a DIB */ INT stride; /* stride of bits if this is a DIB */ + BYTE *own_bits; /* image bits that need to be freed with this object */ }; struct GpCachedBitmap{ diff --git a/reactos/dll/win32/gdiplus/graphics.c b/reactos/dll/win32/gdiplus/graphics.c index 2d512abdc6c..e85a8ba3614 100644 --- a/reactos/dll/win32/gdiplus/graphics.c +++ b/reactos/dll/win32/gdiplus/graphics.c @@ -84,14 +84,22 @@ static BYTE convert_path_point_type(BYTE type) return ret; } +static REAL graphics_res(GpGraphics *graphics) +{ + if (graphics->image) return graphics->image->xres; + else return (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX); +} + static INT prepare_dc(GpGraphics *graphics, GpPen *pen) { HPEN gdipen; REAL width; - INT save_state = SaveDC(graphics->hdc), i, numdashes; + INT save_state, i, numdashes; GpPointF pt[2]; DWORD dash_array[MAX_DASHLEN]; + save_state = SaveDC(graphics->hdc); + EndPath(graphics->hdc); if(pen->unit == UnitPixel){ @@ -108,7 +116,7 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen) width = sqrt((pt[1].X - pt[0].X) * (pt[1].X - pt[0].X) + (pt[1].Y - pt[0].Y) * (pt[1].Y - pt[0].Y)) / sqrt(2.0); - width *= pen->width * convert_unit(graphics->hdc, + width *= pen->width * convert_unit(graphics_res(graphics), pen->unit == UnitWorld ? graphics->unit : pen->unit); } @@ -156,7 +164,7 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti, GpMatrix *matrix; int i; - unitscale = convert_unit(graphics->hdc, graphics->unit); + unitscale = convert_unit(graphics_res(graphics), graphics->unit); /* apply page scale */ if(graphics->unit != UnitDisplay) @@ -1131,6 +1139,8 @@ static GpStatus restore_container(GpGraphics* graphics, static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) { RECT wnd_rect; + GpStatus stat=Ok; + GpUnit unit; if(graphics->hwnd) { if(!GetClientRect(graphics->hwnd, &wnd_rect)) @@ -1140,6 +1150,10 @@ static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) rect->Y = wnd_rect.top; rect->Width = wnd_rect.right - wnd_rect.left; rect->Height = wnd_rect.bottom - wnd_rect.top; + }else if (graphics->image){ + stat = GdipGetImageBounds(graphics->image, rect, &unit); + if (stat == Ok && unit != UnitPixel) + FIXME("need to convert from unit %i\n", unit); }else{ rect->X = 0; rect->Y = 0; @@ -1147,7 +1161,7 @@ static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) rect->Height = GetDeviceCaps(graphics->hdc, VERTRES); } - return Ok; + return stat; } /* on success, rgn will contain the region of the graphics object which @@ -1235,6 +1249,45 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra return Ok; } +GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) +{ + GpStatus retval; + + *graphics = GdipAlloc(sizeof(GpGraphics)); + if(!*graphics) return OutOfMemory; + + if((retval = GdipCreateMatrix(&(*graphics)->worldtrans)) != Ok){ + GdipFree(*graphics); + return retval; + } + + if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){ + GdipFree((*graphics)->worldtrans); + GdipFree(*graphics); + return retval; + } + + (*graphics)->hdc = NULL; + (*graphics)->hwnd = NULL; + (*graphics)->owndc = FALSE; + (*graphics)->image = image; + (*graphics)->smoothing = SmoothingModeDefault; + (*graphics)->compqual = CompositingQualityDefault; + (*graphics)->interpolation = InterpolationModeDefault; + (*graphics)->pixeloffset = PixelOffsetModeDefault; + (*graphics)->compmode = CompositingModeSourceOver; + (*graphics)->unit = UnitDisplay; + (*graphics)->scale = 1.0; + (*graphics)->busy = FALSE; + (*graphics)->textcontrast = 4; + list_init(&(*graphics)->containers); + (*graphics)->contid = 0; + + TRACE("<-- %p\n", *graphics); + + return Ok; +} + GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics) { GpStatus ret; @@ -1446,6 +1499,12 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle); save_state = prepare_dc(graphics, pen); @@ -1482,6 +1541,12 @@ GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pt[0].X = x1; pt[0].Y = y1; pt[1].X = x2; @@ -1516,6 +1581,12 @@ GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pt[0].X = x1; pt[0].Y = y1; pt[1].X = x2; @@ -1722,6 +1793,12 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics *graphics, GpPen *pen, if(count < 2) return InvalidParameter; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pt = GdipAlloc(len_pt * sizeof(GpPointF)); if(!pt) return OutOfMemory; @@ -1837,6 +1914,12 @@ GpStatus WINGDIPAPI GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf[0].X = x; ptf[0].Y = y; ptf[1].X = x + width; @@ -1961,6 +2044,11 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image if (image->picture) { + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + } + /* FIXME: partially implemented (only works for rectangular parallelograms) */ if(srcUnit == UnitInch) dx = dy = (REAL) INCH_HIMETRIC; @@ -1983,7 +2071,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image return GenericError; } } - else if (image->type == ImageTypeBitmap && ((GpBitmap*)image)->hbitmap) + else if (image->type == ImageTypeBitmap) { GpBitmap* bitmap = (GpBitmap*)image; int use_software=0; @@ -1997,6 +2085,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image if (imageAttributes || (graphics->image && graphics->image->type == ImageTypeBitmap) || + !((GpBitmap*)image)->hbitmap || ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X) use_software = 1; @@ -2383,6 +2472,12 @@ GpStatus WINGDIPAPI GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pt[0].X = x1; pt[0].Y = y1; pt[1].X = x2; @@ -2412,6 +2507,12 @@ GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pt[0].X = (REAL)x1; pt[0].Y = (REAL)y1; pt[1].X = (REAL)x2; @@ -2440,6 +2541,12 @@ GpStatus WINGDIPAPI GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + save_state = prepare_dc(graphics, pen); retval = draw_polyline(graphics, pen, points, count, TRUE); @@ -2465,6 +2572,12 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf = GdipAlloc(count * sizeof(GpPointF)); if(!ptf) return OutOfMemory; @@ -2496,6 +2609,12 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path) if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + save_state = prepare_dc(graphics, pen); retval = draw_poly(graphics, pen, path->pathdata.Points, @@ -2520,6 +2639,12 @@ GpStatus WINGDIPAPI GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + save_state = prepare_dc(graphics, pen); SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); @@ -2554,6 +2679,12 @@ GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf[0].X = x; ptf[0].Y = y; ptf[1].X = x + width; @@ -2597,6 +2728,12 @@ GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf = GdipAlloc(4 * count * sizeof(GpPointF)); pti = GdipAlloc(4 * count * sizeof(POINT)); @@ -2673,6 +2810,9 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy; + if(count == 1) /* Do nothing */ + return Ok; + stat = GdipCreatePath(fill, &path); if(stat != Ok) return stat; @@ -2704,9 +2844,12 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, TRACE("(%p, %p, %p, %d, %.2f, %d)\n", graphics, brush, points, count, tension, fill); - if(!points || count <= 0) + if(!points || count == 0) return InvalidParameter; + if(count == 1) /* Do nothing */ + return Ok; + ptf = GdipAlloc(sizeof(GpPointF)*count); if(!ptf) return OutOfMemory; @@ -2723,6 +2866,22 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, return stat; } +GpStatus WINGDIPAPI GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count) +{ + TRACE("(%p, %p, %p, %d)\n", graphics, brush, points, count); + return GdipFillClosedCurve2(graphics, brush, points, count, + 0.5f, FillModeAlternate); +} + +GpStatus WINGDIPAPI GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count) +{ + TRACE("(%p, %p, %p, %d)\n", graphics, brush, points, count); + return GdipFillClosedCurve2I(graphics, brush, points, count, + 0.5f, FillModeAlternate); +} + GpStatus WINGDIPAPI GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height) { @@ -2738,6 +2897,12 @@ GpStatus WINGDIPAPI GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf[0].X = x; ptf[0].Y = y; ptf[1].X = x + width; @@ -2780,6 +2945,12 @@ GpStatus WINGDIPAPI GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *p if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + save_state = SaveDC(graphics->hdc); EndPath(graphics->hdc); SetPolyFillMode(graphics->hdc, (path->fill == FillModeAlternate ? ALTERNATE @@ -2817,6 +2988,12 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + save_state = SaveDC(graphics->hdc); EndPath(graphics->hdc); @@ -2856,6 +3033,12 @@ GpStatus WINGDIPAPI GdipFillPolygon(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf = GdipAlloc(count * sizeof(GpPointF)); pti = GdipAlloc(count * sizeof(POINT)); if(!ptf || !pti){ @@ -2903,6 +3086,12 @@ GpStatus WINGDIPAPI GdipFillPolygonI(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf = GdipAlloc(count * sizeof(GpPointF)); pti = GdipAlloc(count * sizeof(POINT)); if(!ptf || !pti){ @@ -2968,6 +3157,12 @@ GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf[0].X = x; ptf[0].Y = y; ptf[1].X = x + width; @@ -3008,6 +3203,12 @@ GpStatus WINGDIPAPI GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + ptf[0].X = x; ptf[0].Y = y; ptf[1].X = x + width; @@ -3100,6 +3301,12 @@ GpStatus WINGDIPAPI GdipFillRegion(GpGraphics* graphics, GpBrush* brush, if(graphics->busy) return ObjectBusy; + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + status = GdipGetRegionHRgn(region, graphics, &hrgn); if(status != Ok) return status; @@ -3700,6 +3907,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, int i; HFONT oldfont; struct measure_ranges_args args; + HDC temp_hdc=NULL; TRACE("(%p %s %d %p %s %p %d %p)\n", graphics, debugstr_w(string), length, font, debugstr_rectf(layoutRect), stringFormat, regionCount, regions); @@ -3710,6 +3918,12 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, if (regionCount < stringFormat->range_count) return InvalidParameter; + if(!graphics->hdc) + { + temp_hdc = graphics->hdc = CreateCompatibleDC(0); + if (!temp_hdc) return OutOfMemory; + } + if (stringFormat->attr) TRACE("may be ignoring some format flags: attr %x\n", stringFormat->attr); @@ -3729,6 +3943,12 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, DeleteObject(SelectObject(graphics->hdc, oldfont)); + if (temp_hdc) + { + graphics->hdc = NULL; + DeleteDC(temp_hdc); + } + return stat; } @@ -3771,6 +3991,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, { HFONT oldfont; struct measure_string_args args; + HDC temp_hdc=NULL; TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics, debugstr_wn(string, length), length, font, debugstr_rectf(rect), format, @@ -3779,6 +4000,12 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, if(!graphics || !string || !font || !rect || !bounds) return InvalidParameter; + if(!graphics->hdc) + { + temp_hdc = graphics->hdc = CreateCompatibleDC(0); + if (!temp_hdc) return OutOfMemory; + } + if(linesfilled) *linesfilled = 0; if(codepointsfitted) *codepointsfitted = 0; @@ -3801,6 +4028,12 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, DeleteObject(SelectObject(graphics->hdc, oldfont)); + if (temp_hdc) + { + graphics->hdc = NULL; + DeleteDC(temp_hdc); + } + return Ok; } @@ -3852,6 +4085,12 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string return NotImplemented; } + if(!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + if(format){ TRACE("may be ignoring some format flags: attr %x\n", format->attr); @@ -4415,6 +4654,12 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp if(graphics->busy) return ObjectBusy; + if (!graphics->hdc) + { + FIXME("graphics object has no HDC\n"); + return Ok; + } + pti = GdipAlloc(sizeof(POINT) * count); save_state = prepare_dc(graphics, pen); @@ -4462,7 +4707,10 @@ GpStatus WINGDIPAPI GdipGetDpiX(GpGraphics *graphics, REAL* dpi) if(graphics->busy) return ObjectBusy; - *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX); + if (graphics->image) + *dpi = graphics->image->xres; + else + *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX); return Ok; } @@ -4477,7 +4725,10 @@ GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL* dpi) if(graphics->busy) return ObjectBusy; - *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY); + if (graphics->image) + *dpi = graphics->image->yres; + else + *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY); return Ok; } @@ -4505,6 +4756,9 @@ GpStatus WINGDIPAPI GdipMultiplyWorldTransform(GpGraphics *graphics, GDIPCONST G return ret; } +/* Color used to fill bitmaps so we can tell which parts have been drawn over by gdi32. */ +static const COLORREF DC_BACKGROUND_KEY = 0x0c0b0d; + GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc) { TRACE("(%p, %p)\n", graphics, hdc); @@ -4515,7 +4769,61 @@ GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc) if(graphics->busy) return ObjectBusy; - *hdc = graphics->hdc; + if (!graphics->hdc || + (graphics->image && graphics->image->type == ImageTypeBitmap && ((GpBitmap*)graphics->image)->format & PixelFormatAlpha)) + { + /* Create a fake HDC and fill it with a constant color. */ + HDC temp_hdc; + HBITMAP hbitmap; + GpStatus stat; + GpRectF bounds; + BITMAPINFOHEADER bmih; + int i; + + stat = get_graphics_bounds(graphics, &bounds); + if (stat != Ok) + return stat; + + graphics->temp_hbitmap_width = bounds.Width; + graphics->temp_hbitmap_height = bounds.Height; + + bmih.biSize = sizeof(bmih); + bmih.biWidth = graphics->temp_hbitmap_width; + bmih.biHeight = -graphics->temp_hbitmap_height; + bmih.biPlanes = 1; + bmih.biBitCount = 32; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + hbitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, + (void**)&graphics->temp_bits, NULL, 0); + if (!hbitmap) + return GenericError; + + temp_hdc = CreateCompatibleDC(0); + if (!temp_hdc) + { + DeleteObject(hbitmap); + return GenericError; + } + + for (i=0; i<(graphics->temp_hbitmap_width * graphics->temp_hbitmap_height); i++) + ((DWORD*)graphics->temp_bits)[i] = DC_BACKGROUND_KEY; + + SelectObject(temp_hdc, hbitmap); + + graphics->temp_hbitmap = hbitmap; + *hdc = graphics->temp_hdc = temp_hdc; + } + else + { + *hdc = graphics->hdc; + } + graphics->busy = TRUE; return Ok; @@ -4525,12 +4833,40 @@ GpStatus WINGDIPAPI GdipReleaseDC(GpGraphics *graphics, HDC hdc) { TRACE("(%p, %p)\n", graphics, hdc); - if(!graphics) + if(!graphics || !hdc) return InvalidParameter; - if(graphics->hdc != hdc || !(graphics->busy)) + if((graphics->hdc != hdc && graphics->temp_hdc != hdc) || !(graphics->busy)) return InvalidParameter; + if (graphics->temp_hdc == hdc) + { + DWORD* pos; + int i; + + /* Find the pixels that have changed, and mark them as opaque. */ + pos = (DWORD*)graphics->temp_bits; + for (i=0; i<(graphics->temp_hbitmap_width * graphics->temp_hbitmap_height); i++) + { + if (*pos != DC_BACKGROUND_KEY) + { + *pos |= 0xff000000; + } + pos++; + } + + /* Write the changed pixels to the real target. */ + alpha_blend_pixels(graphics, 0, 0, graphics->temp_bits, + graphics->temp_hbitmap_width, graphics->temp_hbitmap_height, + graphics->temp_hbitmap_width * 4); + + /* Clean up. */ + DeleteDC(graphics->temp_hdc); + DeleteObject(graphics->temp_hbitmap); + graphics->temp_hdc = NULL; + graphics->temp_hbitmap = NULL; + } + graphics->busy = FALSE; return Ok; @@ -4580,7 +4916,7 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace stat = GdipCreateMatrix(&matrix); if (stat == Ok) { - unitscale = convert_unit(graphics->hdc, graphics->unit); + unitscale = convert_unit(graphics_res(graphics), graphics->unit); if(graphics->unit != UnitDisplay) unitscale *= graphics->scale; diff --git a/reactos/dll/win32/gdiplus/graphicspath.c b/reactos/dll/win32/gdiplus/graphicspath.c index 60ddda1d7b5..983ead95008 100644 --- a/reactos/dll/win32/gdiplus/graphicspath.c +++ b/reactos/dll/win32/gdiplus/graphicspath.c @@ -364,7 +364,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po } /* points [len_pt-2] and [0] are calculated - separetely to connect splines properly */ + separately to connect splines properly */ pts[0] = points[count-1]; pts[1] = points[0]; /* equals to start and end of a resulting path */ pts[2] = points[1]; @@ -1653,3 +1653,9 @@ GpStatus WINGDIPAPI GdipClearPathMarkers(GpPath* path) return Ok; } + +GpStatus WINGDIPAPI GdipWindingModeOutline(GpPath *path, GpMatrix *matrix, REAL flatness) +{ + FIXME("stub: %p, %p, %.2f\n", path, matrix, flatness); + return NotImplemented; +} diff --git a/reactos/dll/win32/gdiplus/image.c b/reactos/dll/win32/gdiplus/image.c index d72ae8d3775..69f58659a28 100644 --- a/reactos/dll/win32/gdiplus/image.c +++ b/reactos/dll/win32/gdiplus/image.c @@ -1626,11 +1626,10 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap) { BITMAPINFO* pbmi; - HBITMAP hbitmap; + HBITMAP hbitmap=NULL; INT row_size, dib_stride; HDC hdc; - BYTE *bits; - int i; + BYTE *bits=NULL, *own_bits=NULL; REAL xres, yres; GpStatus stat; @@ -1655,46 +1654,62 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, if(stride == 0) stride = dib_stride; - pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - if (!pbmi) - return OutOfMemory; + if (format & PixelFormatGDI && !(format & (PixelFormatAlpha|PixelFormatIndexed)) && !scan0) + { + pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); + if (!pbmi) + return OutOfMemory; - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = width; - pbmi->bmiHeader.biHeight = -height; - pbmi->bmiHeader.biPlanes = 1; - /* FIXME: use the rest of the data from format */ - pbmi->bmiHeader.biBitCount = PIXELFORMATBPP(format); - pbmi->bmiHeader.biCompression = BI_RGB; - pbmi->bmiHeader.biSizeImage = 0; - pbmi->bmiHeader.biXPelsPerMeter = 0; - pbmi->bmiHeader.biYPelsPerMeter = 0; - pbmi->bmiHeader.biClrUsed = 0; - pbmi->bmiHeader.biClrImportant = 0; + pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pbmi->bmiHeader.biWidth = width; + pbmi->bmiHeader.biHeight = -height; + pbmi->bmiHeader.biPlanes = 1; + /* FIXME: use the rest of the data from format */ + pbmi->bmiHeader.biBitCount = PIXELFORMATBPP(format); + pbmi->bmiHeader.biCompression = BI_RGB; + pbmi->bmiHeader.biSizeImage = 0; + pbmi->bmiHeader.biXPelsPerMeter = 0; + pbmi->bmiHeader.biYPelsPerMeter = 0; + pbmi->bmiHeader.biClrUsed = 0; + pbmi->bmiHeader.biClrImportant = 0; - hdc = CreateCompatibleDC(NULL); - if (!hdc) { + hdc = CreateCompatibleDC(NULL); + if (!hdc) { + GdipFree(pbmi); + return GenericError; + } + + hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); + + DeleteDC(hdc); GdipFree(pbmi); - return GenericError; + + if (!hbitmap) return GenericError; + + stride = dib_stride; } + else + { + /* Not a GDI format; don't try to make an HBITMAP. */ + if (scan0) + bits = scan0; + else + { + INT size = abs(stride) * height; - hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); + own_bits = bits = GdipAlloc(size); + if (!own_bits) return OutOfMemory; - DeleteDC(hdc); - GdipFree(pbmi); - - if (!hbitmap) return GenericError; - - /* copy bits to the dib if necessary */ - /* FIXME: should reference the bits instead of copying them */ - if (scan0) - for (i=0; ihbitmap = hbitmap; (*bitmap)->hdc = NULL; (*bitmap)->bits = bits; - (*bitmap)->stride = dib_stride; + (*bitmap)->stride = stride; + (*bitmap)->own_bits = own_bits; + + /* set format-related flags */ + if (format & (PixelFormatAlpha|PixelFormatPAlpha|PixelFormatIndexed)) + (*bitmap)->image.flags |= ImageFlagsHasAlpha; if (format == PixelFormat1bppIndexed || format == PixelFormat4bppIndexed || @@ -1916,6 +1936,7 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette) dst->hdc = src->hdc; dst->bits = src->bits; dst->stride = src->stride; + dst->own_bits = src->own_bits; GdipFree(src); } @@ -1927,15 +1948,22 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image) if(!image) return InvalidParameter; - if (image->picture) - IPicture_Release(image->picture); if (image->type == ImageTypeBitmap) { GdipFree(((GpBitmap*)image)->bitmapbits); + GdipFree(((GpBitmap*)image)->own_bits); DeleteDC(((GpBitmap*)image)->hdc); DeleteObject(((GpBitmap*)image)->hbitmap); } + else if (image->type != ImageTypeMetafile) + { + WARN("invalid image: %p\n", image); + return ObjectBusy; + } + if (image->picture) + IPicture_Release(image->picture); GdipFree(image->palette_entries); + image->type = ~0; GdipFree(image); return Ok; @@ -2008,14 +2036,15 @@ GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width, if(image->type == ImageTypeMetafile){ HDC hdc = GetDC(0); - - *height = convert_unit(hdc, ((GpMetafile*)image)->unit) * - ((GpMetafile*)image)->bounds.Height; - - *width = convert_unit(hdc, ((GpMetafile*)image)->unit) * - ((GpMetafile*)image)->bounds.Width; + REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(0, hdc); + + *height = convert_unit(res, ((GpMetafile*)image)->unit) * + ((GpMetafile*)image)->bounds.Height; + + *width = convert_unit(res, ((GpMetafile*)image)->unit) * + ((GpMetafile*)image)->bounds.Width; } else if(image->type == ImageTypeBitmap){ @@ -2047,18 +2076,23 @@ GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, return NotImplemented; } - hdc = ((GpBitmap*)image)->hdc; + if (((GpBitmap*)image)->hbitmap) + { + hdc = ((GpBitmap*)image)->hdc; - if(!hdc){ - hdc = CreateCompatibleDC(0); - SelectObject(hdc, ((GpBitmap*)image)->hbitmap); - ((GpBitmap*)image)->hdc = hdc; + if(!hdc){ + hdc = CreateCompatibleDC(0); + SelectObject(hdc, ((GpBitmap*)image)->hbitmap); + ((GpBitmap*)image)->hdc = hdc; + } + + stat = GdipCreateFromHDC(hdc, graphics); + + if (stat == Ok) + (*graphics)->image = image; } - - stat = GdipCreateFromHDC(hdc, graphics); - - if (stat == Ok) - (*graphics)->image = image; + else + stat = graphics_from_image(image, graphics); return stat; } @@ -2072,11 +2106,12 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height) if(image->type == ImageTypeMetafile){ HDC hdc = GetDC(0); - - *height = roundr(convert_unit(hdc, ((GpMetafile*)image)->unit) * - ((GpMetafile*)image)->bounds.Height); + REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(0, hdc); + + *height = roundr(convert_unit(res, ((GpMetafile*)image)->unit) * + ((GpMetafile*)image)->bounds.Height); } else if(image->type == ImageTypeBitmap) *height = ((GpBitmap*)image)->height; @@ -2178,11 +2213,12 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width) if(image->type == ImageTypeMetafile){ HDC hdc = GetDC(0); - - *width = roundr(convert_unit(hdc, ((GpMetafile*)image)->unit) * - ((GpMetafile*)image)->bounds.Width); + REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(0, hdc); + + *width = roundr(convert_unit(res, ((GpMetafile*)image)->unit) * + ((GpMetafile*)image)->bounds.Width); } else if(image->type == ImageTypeBitmap) *width = ((GpBitmap*)image)->width; @@ -2566,6 +2602,18 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, GpImage **imag *image = NULL; GdipDisposeImage((GpImage*)bitmap); } + + if (SUCCEEDED(hr) && status == Ok) + { + double dpix, dpiy; + hr = IWICBitmapSource_GetResolution(source, &dpix, &dpiy); + if (SUCCEEDED(hr)) + { + bitmap->image.xres = dpix; + bitmap->image.yres = dpiy; + } + hr = S_OK; + } } IWICBitmapSource_Release(source); @@ -2581,6 +2629,12 @@ end: if (FAILED(hr) && status == Ok) status = hresult_to_status(hr); + if (status == Ok) + { + /* Native GDI+ used to be smarter, but since Win7 it just sets these flags. */ + bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI|ImageFlagsColorSpaceRGB; + } + return status; } @@ -3756,3 +3810,16 @@ GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type) return stat; } + +/***************************************************************************** + * GdipConvertToEmfPlusToFile [GDIPLUS.@] + */ + +GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics, + GpMetafile* metafile, BOOL* conversionSuccess, + const WCHAR* filename, EmfType emfType, + const WCHAR* description, GpMetafile** out_metafile) +{ + FIXME("stub: %p, %p, %p, %p, %u, %p, %p\n", refGraphics, metafile, conversionSuccess, filename, emfType, description, out_metafile); + return NotImplemented; +} diff --git a/reactos/dll/win32/gdiplus/pen.c b/reactos/dll/win32/gdiplus/pen.c index 53e47f08f77..a022cfb64e0 100644 --- a/reactos/dll/win32/gdiplus/pen.c +++ b/reactos/dll/win32/gdiplus/pen.c @@ -404,6 +404,51 @@ GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen) return NotImplemented; } +GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix) +{ + static int calls; + + TRACE("(%p,%p)\n", pen, matrix); + + if(!pen || !matrix) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix) +{ + static int calls; + + TRACE("(%p,%p)\n", pen, matrix); + + if(!pen || !matrix) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order); + + if(!pen) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order) { static int calls; @@ -419,6 +464,21 @@ GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrix return NotImplemented; } +GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order) +{ + static int calls; + + TRACE("(%p,%0.2f,%u)\n", pen, angle, order); + + if(!pen) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, GpMatrixOrder order) { diff --git a/reactos/dll/win32/gdiplus/region.c b/reactos/dll/win32/gdiplus/region.c index decaaf9e837..f11f3ca3669 100644 --- a/reactos/dll/win32/gdiplus/region.c +++ b/reactos/dll/win32/gdiplus/region.c @@ -884,6 +884,7 @@ GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT *needed) static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn) { HDC new_hdc=NULL; + GpGraphics *new_graphics=NULL; GpStatus stat; INT save_state; @@ -893,13 +894,20 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn) if (!new_hdc) return OutOfMemory; - stat = GdipCreateFromHDC(new_hdc, &graphics); + stat = GdipCreateFromHDC(new_hdc, &new_graphics); + graphics = new_graphics; if (stat != Ok) { ReleaseDC(0, new_hdc); return stat; } } + else if (!graphics->hdc) + { + graphics->hdc = new_hdc = GetDC(0); + if (!new_hdc) + return OutOfMemory; + } save_state = SaveDC(graphics->hdc); EndPath(graphics->hdc); @@ -918,7 +926,10 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn) if (new_hdc) { ReleaseDC(0, new_hdc); - GdipDeleteGraphics(graphics); + if (new_graphics) + GdipDeleteGraphics(new_graphics); + else + graphics->hdc = NULL; } return stat; @@ -1248,11 +1259,66 @@ GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region) return stat; } +/* Transforms GpRegion elements with given matrix */ +static GpStatus transform_region_element(region_element* element, GpMatrix *matrix) +{ + GpStatus stat; + + switch(element->type) + { + case RegionDataEmptyRect: + case RegionDataInfiniteRect: + return Ok; + case RegionDataRect: + { + /* We can't transform a rectangle, so convert it to a path. */ + GpRegion *new_region; + GpPath *path; + + stat = GdipCreatePath(FillModeAlternate, &path); + if (stat == Ok) + { + stat = GdipAddPathRectangle(path, + element->elementdata.rect.X, element->elementdata.rect.Y, + element->elementdata.rect.Width, element->elementdata.rect.Height); + + if (stat == Ok) + stat = GdipCreateRegionPath(path, &new_region); + + GdipDeletePath(path); + } + + if (stat == Ok) + { + /* Steal the element from the created region. */ + memcpy(element, &new_region->node, sizeof(region_element)); + HeapFree(GetProcessHeap(), 0, new_region); + } + else + return stat; + } + /* Fall-through to do the actual conversion. */ + case RegionDataPath: + stat = GdipTransformMatrixPoints(matrix, + element->elementdata.pathdata.path->pathdata.Points, + element->elementdata.pathdata.path->pathdata.Count); + return stat; + default: + stat = transform_region_element(element->elementdata.combine.left, matrix); + if (stat == Ok) + stat = transform_region_element(element->elementdata.combine.right, matrix); + return stat; + } +} + GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix) { - FIXME("(%p, %p): stub\n", region, matrix); + TRACE("(%p, %p)\n", region, matrix); - return NotImplemented; + if (!region || !matrix) + return InvalidParameter; + + return transform_region_element(®ion->node, matrix); } /* Translates GpRegion elements with specified offsets */ @@ -1307,14 +1373,150 @@ GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *region, INT dx, INT dy) return GdipTranslateRegion(region, (REAL)dx, (REAL)dy); } +static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGNDATA *data) +{ + GpRegion *region_copy; + GpStatus stat; + HRGN hrgn; + DWORD data_size; + + stat = GdipCloneRegion(region, ®ion_copy); + + if (stat == Ok) + { + stat = GdipTransformRegion(region_copy, matrix); + + if (stat == Ok) + stat = GdipGetRegionHRgn(region_copy, NULL, &hrgn); + + if (stat == Ok) + { + if (hrgn) + { + data_size = GetRegionData(hrgn, 0, NULL); + + *data = GdipAlloc(data_size); + + if (*data) + GetRegionData(hrgn, data_size, *data); + else + stat = OutOfMemory; + + DeleteObject(hrgn); + } + else + { + data_size = sizeof(RGNDATAHEADER) + sizeof(RECT); + + *data = GdipAlloc(data_size); + + if (*data) + { + (*data)->rdh.dwSize = sizeof(RGNDATAHEADER); + (*data)->rdh.iType = RDH_RECTANGLES; + (*data)->rdh.nCount = 1; + (*data)->rdh.nRgnSize = sizeof(RECT); + (*data)->rdh.rcBound.left = (*data)->rdh.rcBound.top = -0x400000; + (*data)->rdh.rcBound.right = (*data)->rdh.rcBound.bottom = 0x400000; + + memcpy(&(*data)->Buffer, &(*data)->rdh.rcBound, sizeof(RECT)); + } + else + stat = OutOfMemory; + } + } + + GdipDeleteRegion(region_copy); + } + + return stat; +} + GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMatrix *matrix) { - static int calls; + GpStatus stat; + LPRGNDATA data; TRACE("(%p, %p, %p)\n", region, count, matrix); - if (!(calls++)) - FIXME("not implemented\n"); + if (!region || !count || !matrix) + return InvalidParameter; - return NotImplemented; + stat = get_region_scans_data(region, matrix, &data); + + if (stat == Ok) + { + *count = data->rdh.nCount; + GdipFree(data); + } + + return stat; +} + +GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *count, GpMatrix *matrix) +{ + GpStatus stat; + INT i; + LPRGNDATA data; + RECT *rects; + + if (!region || !count || !matrix) + return InvalidParameter; + + stat = get_region_scans_data(region, matrix, &data); + + if (stat == Ok) + { + *count = data->rdh.nCount; + rects = (RECT*)&data->Buffer; + + if (scans) + { + for (i=0; irdh.nCount; i++) + { + scans[i].X = rects[i].left; + scans[i].Y = rects[i].top; + scans[i].Width = rects[i].right - rects[i].left; + scans[i].Height = rects[i].bottom - rects[i].top; + } + } + + GdipFree(data); + } + + return Ok; +} + +GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *count, GpMatrix *matrix) +{ + GpStatus stat; + INT i; + LPRGNDATA data; + RECT *rects; + + if (!region || !count || !matrix) + return InvalidParameter; + + stat = get_region_scans_data(region, matrix, &data); + + if (stat == Ok) + { + *count = data->rdh.nCount; + rects = (RECT*)&data->Buffer; + + if (scans) + { + for (i=0; irdh.nCount; i++) + { + scans[i].X = rects[i].left; + scans[i].Y = rects[i].top; + scans[i].Width = rects[i].right - rects[i].left; + scans[i].Height = rects[i].bottom - rects[i].top; + } + } + + GdipFree(data); + } + + return Ok; } diff --git a/reactos/dll/win32/wer/main.c b/reactos/dll/win32/wer/main.c new file mode 100644 index 00000000000..585ac91a30b --- /dev/null +++ b/reactos/dll/win32/wer/main.c @@ -0,0 +1,321 @@ +/* + * Copyright 2010 Louis Lenders + * Copyright 2010 Detlef Riekenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "werapi.h" +#include "wine/list.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wer); + +typedef struct { + struct list entry; + WER_REPORT_INFORMATION info; + WER_REPORT_TYPE reporttype; + WCHAR eventtype[1]; +} report_t; + + +static CRITICAL_SECTION report_table_cs; +static CRITICAL_SECTION_DEBUG report_table_cs_debug = +{ + 0, 0, &report_table_cs, + { &report_table_cs_debug.ProcessLocksList, &report_table_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": report_table_cs") } +}; +static CRITICAL_SECTION report_table_cs = { &report_table_cs_debug, -1, 0, 0, 0, 0 }; + +static struct list report_table = LIST_INIT(report_table); + +static WCHAR regpath_exclude[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s',' ','E','r','r','o','r',' ','R','e','p','o','r','t','i','n','g','\\', + 'E','x','c','l','u','d','e','d','A','p','p','l','i','c','a','t','i','o','n','s',0}; + +/*********************************************************************** + * Memory alloccation helper + */ + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +/*********************************************************************** + * WerAddExcludedApplication (wer.@) + * + * Add an application to the user specific or the system wide exclusion list + * + * PARAMS + * exeName [i] The application name + * allUsers [i] for all users (TRUE) or for the current user (FALSE) + * + * RETURNS + * Success: S_OK + * Faulure: A HRESULT error code + * + */ +HRESULT WINAPI WerAddExcludedApplication(PCWSTR exeName, BOOL allUsers) +{ + HKEY hkey; + DWORD value = 1; + LPWSTR bs; + + TRACE("(%s, %d)\n",debugstr_w(exeName), allUsers); + if (!exeName || !exeName[0]) + return E_INVALIDARG; + + bs = strrchrW(exeName, '\\'); + if (bs) { + bs++; /* skip the backslash */ + if (!bs[0]) { + return E_INVALIDARG; + } + } else + bs = (LPWSTR) exeName; + + if (!RegCreateKeyW(allUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, regpath_exclude, &hkey)) { + RegSetValueExW(hkey, bs, 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD)); + RegCloseKey(hkey); + return S_OK; + } + return E_ACCESSDENIED; +} + +/*********************************************************************** + * WerRemoveExcludedApplication (wer.@) + * + * remove an application from the exclusion list + * + * PARAMS + * exeName [i] The application name + * allUsers [i] for all users (TRUE) or for the current user (FALSE) + * + * RETURNS + * Success: S_OK + * Faulure: A HRESULT error code + * + */ +HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR exeName, BOOL allUsers) +{ + HKEY hkey; + LPWSTR bs; + LONG lres; + + TRACE("(%s, %d)\n",debugstr_w(exeName), allUsers); + if (!exeName || !exeName[0]) + return E_INVALIDARG; + + bs = strrchrW(exeName, '\\'); + if (bs) { + bs++; /* skip the backslash */ + if (!bs[0]) { + return E_INVALIDARG; + } + } else + bs = (LPWSTR) exeName; + + if (!RegCreateKeyW(allUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, regpath_exclude, &hkey)) { + lres = RegDeleteValueW(hkey, bs); + RegCloseKey(hkey); + return lres ? __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND) : S_OK; + } + return E_ACCESSDENIED; +} + +/*********************************************************************** + * WerReportCloseHandle (wer.@) + * + * Close an error reporting handle and free associated resources + * + * PARAMS + * hreport [i] error reporting handle to close + * + * RETURNS + * Success: S_OK + * Failure: A HRESULT error code + * + */ +HRESULT WINAPI WerReportCloseHandle(HREPORT hreport) +{ + report_t * report = (report_t *) hreport; + report_t * cursor; + BOOL found = FALSE; + + TRACE("(%p)\n", hreport); + EnterCriticalSection(&report_table_cs); + if (report) { + LIST_FOR_EACH_ENTRY(cursor, &report_table, report_t, entry) + { + if (cursor == report) { + found = TRUE; + list_remove(&report->entry); + break; + } + } + } + LeaveCriticalSection(&report_table_cs); + if (!found) + return E_INVALIDARG; + + heap_free(report); + + return S_OK; +} + +/*********************************************************************** + * WerReportCreate (wer.@) + * + * Create an error report in memory and return a related HANDLE + * + * PARAMS + * eventtype [i] a name for the event type + * reporttype [i] what type of report should be created + * reportinfo [i] NULL or a ptr to a struct with some detailed information + * phandle [o] ptr, where the resulting handle should be saved + * + * RETURNS + * Success: S_OK + * Failure: A HRESULT error code + * + * NOTES + * The event type must be registered at microsoft. Predefined types are + * "APPCRASH" as the default on Windows, "Crash32" and "Crash64" + * + */ +HRESULT WINAPI WerReportCreate(PCWSTR eventtype, WER_REPORT_TYPE reporttype, PWER_REPORT_INFORMATION reportinfo, HREPORT *phandle) +{ + report_t *report; + DWORD len; + + TRACE("(%s, %d, %p, %p)\n", debugstr_w(eventtype), reporttype, reportinfo, phandle); + if (reportinfo) { + TRACE(".wzFriendlyEventName: %s\n", debugstr_w(reportinfo->wzFriendlyEventName)); + TRACE(".wzApplicationName: %s\n", debugstr_w(reportinfo->wzApplicationName)); + } + + if (phandle) *phandle = NULL; + if (!eventtype || !eventtype[0] || !phandle) { + return E_INVALIDARG; + } + + len = lstrlenW(eventtype) + 1; + + report = heap_alloc_zero(len * sizeof(WCHAR) + sizeof(report_t)); + if (!report) + return __HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY); + + lstrcpyW(report->eventtype, eventtype); + report->reporttype = reporttype; + + if (reportinfo) { + report->info = *reportinfo; + } else { + FIXME("build report information from scratch for %p\n", report); + } + + EnterCriticalSection(&report_table_cs); + list_add_head(&report_table, &report->entry); + LeaveCriticalSection(&report_table_cs); + + *phandle = report; + TRACE("=> %p\n", report); + return S_OK; +} + +/*********************************************************************** + * WerReportSetParameter (wer.@) + * + * Set one of 10 parameter / value pairs for a report handle + * + * PARAMS + * hreport [i] error reporting handle to add the parameter + * id [i] parameter to set (WER_P0 upto WER_P9) + * name [i] optional name of the parameter + * value [i] value of the parameter + * + * RETURNS + * Success: S_OK + * Failure: A HRESULT error code + * + */ +HRESULT WINAPI WerReportSetParameter(HREPORT hreport, DWORD id, PCWSTR name, PCWSTR value) +{ + FIXME("(%p, %d, %s, %s) :stub\n", hreport, id, debugstr_w(name), debugstr_w(value)); + + return E_NOTIMPL; +} + +/*********************************************************************** + * WerReportSubmit (wer.@) + * + * Ask the user for permission and send the error report + * then kill or restart the application, when requested + * + * PARAMS + * hreport [i] error reporting handle to send + * consent [i] current transmit permission + * flags [i] flag to select dialog, transmission snd restart options + * presult [o] ptr, where the transmission result should be saved + * + * RETURNS + * Success: S_OK + * Failure: A HRESULT error code + * + */ +HRESULT WINAPI WerReportSubmit(HREPORT hreport, WER_CONSENT consent, DWORD flags, PWER_SUBMIT_RESULT presult) +{ + FIXME("(%p, %d, 0x%x, %p) :stub\n", hreport, consent, flags, presult); + + if(!presult) + return E_INVALIDARG; + + *presult = WerDisabled; + return E_NOTIMPL; +} diff --git a/reactos/dll/win32/wer/wer.rbuild b/reactos/dll/win32/wer/wer.rbuild new file mode 100644 index 00000000000..852102966ba --- /dev/null +++ b/reactos/dll/win32/wer/wer.rbuild @@ -0,0 +1,11 @@ + + + + + . + include/reactos/wine + + advapi32 + wine + main.c + diff --git a/reactos/dll/win32/wer/wer.spec b/reactos/dll/win32/wer/wer.spec new file mode 100644 index 00000000000..4303c204b7e --- /dev/null +++ b/reactos/dll/win32/wer/wer.spec @@ -0,0 +1,77 @@ +@ stub WerSysprepCleanup +@ stub WerSysprepGeneralize +@ stub WerSysprepSpecialize +@ stub WerUnattendedSetup +@ stub WerpAddAppCompatData +@ stub WerpAddFile +@ stub WerpAddMemoryBlock +@ stub WerpAddRegisteredDataToReport +@ stub WerpAddSecondaryParameter +@ stub WerpAddTextToReport +@ stub WerpArchiveReport +@ stub WerpCancelResponseDownload +@ stub WerpCancelUpload +@ stub WerpCloseStore +@ stub WerpCreateMachineStore +@ stub WerpDeleteReport +@ stub WerpDestroyWerString +@ stub WerpDownloadResponse +@ stub WerpDownloadResponseTemplate +@ stub WerpEnumerateStoreNext +@ stub WerpEnumerateStoreStart +@ stub WerpExtractReportFiles +@ stub WerpGetBucketId +@ stub WerpGetDynamicParameter +@ stub WerpGetEventType +@ stub WerpGetFileByIndex +@ stub WerpGetFilePathByIndex +@ stub WerpGetNumFiles +@ stub WerpGetNumSecParams +@ stub WerpGetNumSigParams +@ stub WerpGetReportFinalConsent +@ stub WerpGetReportFlags +@ stub WerpGetReportInformation +@ stub WerpGetReportTime +@ stub WerpGetReportType +@ stub WerpGetResponseId +@ stub WerpGetResponseUrl +@ stub WerpGetSecParamByIndex +@ stub WerpGetSigParamByIndex +@ stub WerpGetStoreLocation +@ stub WerpGetStoreType +@ stub WerpGetTextFromReport +@ stub WerpGetUIParamByIndex +@ stub WerpGetUploadTime +@ stub WerpGetWerStringData +@ stub WerpIsTransportAvailable +@ stub WerpLoadReport +@ stub WerpOpenMachineArchive +@ stub WerpOpenMachineQueue +@ stub WerpOpenUserArchive +@ stub WerpReportCancel +@ stub WerpRestartApplication +@ stub WerpSetDynamicParameter +@ stub WerpSetEventName +@ stub WerpSetReportFlags +@ stub WerpSetReportInformation +@ stub WerpSetReportTime +@ stub WerpSetReportUploadContextToken +@ stub WerpShowNXNotification +@ stub WerpShowSecondLevelConsent +@ stub WerpShowUpsellUI +@ stub WerpSubmitReportFromStore +@ stub WerpSvcReportFromMachineQueue +@ stdcall WerAddExcludedApplication(wstr long) +@ stdcall WerRemoveExcludedApplication(wstr long) +@ stub WerReportAddDump +@ stub WerReportAddFile +@ stdcall WerReportCloseHandle(ptr) +@ stdcall WerReportCreate(wstr long ptr ptr) +@ stdcall WerReportSetParameter(ptr long wstr wstr) +@ stub WerReportSetUIOption +@ stdcall WerReportSubmit(ptr long long ptr) +@ stub WerpGetReportConsent +@ stub WerpIsDisabled +@ stub WerpOpenUserQueue +@ stub WerpPromtUser +@ stub WerpSetCallBack diff --git a/reactos/dll/win32/win32.rbuild b/reactos/dll/win32/win32.rbuild index 5cd3d741736..30dbf94704c 100644 --- a/reactos/dll/win32/win32.rbuild +++ b/reactos/dll/win32/win32.rbuild @@ -595,6 +595,9 @@ + + + diff --git a/reactos/include/psdk/werapi.h b/reactos/include/psdk/werapi.h new file mode 100644 index 00000000000..4b79c041787 --- /dev/null +++ b/reactos/include/psdk/werapi.h @@ -0,0 +1,127 @@ +/* + * Windows Error Reporing definitions + * + * Copyright (C) 2010 Louis Lenders + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WERAPI_H +#define __WINE_WERAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Only 10 parameter are allowed in WerReportSetParameter */ +#define WER_MAX_PARAM_COUNT 10 +#define WER_P0 0 +#define WER_P1 1 +#define WER_P2 2 +#define WER_P3 3 +#define WER_P4 4 +#define WER_P5 5 +#define WER_P6 6 +#define WER_P7 7 +#define WER_P8 8 +#define WER_P9 9 + +/* Flags for WerReportSubmit */ +#define WER_SUBMIT_HONOR_RECOVERY 0x0001 +#define WER_SUBMIT_HONOR_RESTART 0x0002 +#define WER_SUBMIT_QUEUE 0x0004 +#define WER_SUBMIT_SHOW_DEBUG 0x0008 +#define WER_SUBMIT_ADD_REGISTERED_DATA 0x0010 +#define WER_SUBMIT_OUTOFPROCESS 0x0020 +#define WER_SUBMIT_NO_CLOSE_UI 0x0040 +#define WER_SUBMIT_NO_QUEUE 0x0080 +#define WER_SUBMIT_NO_ARCHIVE 0x0100 +#define WER_SUBMIT_START_MINIMIZED 0x0200 +#define WER_SUBMIT_OUTOFPROCESS_ASYNC 0x0400 +#define WER_SUBMIT_BYPASS_DATA_THROTTLING 0x0800 +#define WER_SUBMIT_ARCHIVE_PARAMETERS_ONLY 0x1000 +#define WER_SUBMIT_REPORT_MACHINE_ID 0x2000 + +/* #### */ + +typedef HANDLE HREPORT; + +typedef enum _WER_CONSENT +{ + WerConsentNotAsked = 1, + WerConsentApproved, + WerConsentDenied, + WerConsentAlwaysPrompt, + WerConsentMax +} WER_CONSENT; + +typedef enum _WER_REGISTER_FILE_TYPE +{ + WerRegFileTypeUserDocument = 1, + WerRegFileTypeOther = 2, + WerRegFileTypeMax +} WER_REGISTER_FILE_TYPE; + +typedef struct _WER_REPORT_INFORMATION +{ + DWORD dwSize; + HANDLE hProcess; + WCHAR wzConsentKey[64]; + WCHAR wzFriendlyEventName[128]; + WCHAR wzApplicationName[128]; + WCHAR wzApplicationPath[MAX_PATH]; + WCHAR wzDescription[512]; + HWND hwndParent; +} WER_REPORT_INFORMATION, *PWER_REPORT_INFORMATION; + + +typedef enum _WER_REPORT_TYPE +{ + WerReportNonCritical = 0, + WerReportCritical, + WerReportApplicationCrash, + WerReportApplicationHang, + WerReportKernel, + WerReportInvalid +} WER_REPORT_TYPE; + +typedef enum _WER_SUBMIT_RESULT +{ + WerReportQueued = 1, + WerReportUploaded, + WerReportDebug, + WerReportFailed, + WerDisabled, + WerReportCancelled, + WerDisabledQueue, + WerReportAsync, + WerCustomAction +} WER_SUBMIT_RESULT, *PWER_SUBMIT_RESULT; + +/* #### */ + +HRESULT WINAPI WerAddExcludedApplication(PCWSTR, BOOL); +HRESULT WINAPI WerRegisterFile(PCWSTR file, WER_REGISTER_FILE_TYPE regfiletype, DWORD flags); +HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR, BOOL); +HRESULT WINAPI WerReportCloseHandle(HREPORT); +HRESULT WINAPI WerReportCreate(PCWSTR, WER_REPORT_TYPE, PWER_REPORT_INFORMATION, HREPORT*); +HRESULT WINAPI WerReportSetParameter(HREPORT, DWORD, PCWSTR, PCWSTR); +HRESULT WINAPI WerReportSubmit(HREPORT, WER_CONSENT, DWORD, PWER_SUBMIT_RESULT); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_WERAPI_H */ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index d03bb636129..0937d63e64b 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -167,6 +167,7 @@ reactos/dll/win32/urlmon # Autosync reactos/dll/win32/usp10 # Autosync reactos/dll/win32/uxtheme # Autosync reactos/dll/win32/version # Autosync +reactos/dll/win32/wer # Autosync reactos/dll/win32/windowscodecs # Autosync reactos/dll/win32/winemp3.acm # Autosync reactos/dll/win32/wininet # Autosync From ebec2dd826ad3292fc772d780fc31f83622ed2ed Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 20 Nov 2010 12:07:24 +0000 Subject: [PATCH 038/132] [NTOSKRNL] Fix potential buffer overflow svn path=/trunk/; revision=49659 --- reactos/ntoskrnl/ke/freeldr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/ke/freeldr.c b/reactos/ntoskrnl/ke/freeldr.c index 866d0a7ca2b..9dfc8eb9e07 100644 --- a/reactos/ntoskrnl/ke/freeldr.c +++ b/reactos/ntoskrnl/ke/freeldr.c @@ -1206,14 +1206,10 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock, 0, &Base); - // - // Check if we have a ramdisk - // + /* Check if we have a ramdisk */ if ((RosLoaderBlock->RdAddr) && (RosLoaderBlock->RdLength)) { - // - // Build a descriptor for it - // + /* Build a descriptor for it */ KiRosAllocateNtDescriptor(LoaderXIPRom, KERNEL_DESCRIPTOR_PAGE(RosLoaderBlock->RdAddr), (RosLoaderBlock->RdLength + PAGE_SIZE - 1) >> PAGE_SHIFT, @@ -1267,7 +1263,7 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock, HalPath = strchr(BootPath + 1, ' '); *HalPath = ANSI_NULL; BldrNtBootPath[0] = '\\'; - strncat(BldrNtBootPath, BootPath + 1, 63); + strncat(BldrNtBootPath, BootPath + 1, 61); strcat(BldrNtBootPath,"\\"); LoaderBlock->NtBootPathName = BldrNtBootPath; From 3eb9ba0807a43873471d8f817ad0f3e043b7a28a Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 20 Nov 2010 13:54:45 +0000 Subject: [PATCH 039/132] [NTOSKRNL] [HAL] Disable INIT_FUNCTION to see whether it's responsible for Qemu broken status. Some are complaining of unworking trunk since r49463. This will be reverted after tests. svn path=/trunk/; revision=49662 --- reactos/hal/halx86/include/halp.h | 2 +- reactos/ntoskrnl/include/internal/ntoskrnl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/hal/halx86/include/halp.h b/reactos/hal/halx86/include/halp.h index cbb372a1e47..c7b921fb75c 100644 --- a/reactos/hal/halx86/include/halp.h +++ b/reactos/hal/halx86/include/halp.h @@ -6,7 +6,7 @@ #define PLACE_IN_SECTION(s) __attribute__((section (s))) #ifdef __GNUC__ -#define INIT_FUNCTION PLACE_IN_SECTION("init") +#define INIT_FUNCTION #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #else diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index f5354eea293..ceb4800423f 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -5,7 +5,7 @@ */ #define PLACE_IN_SECTION(s) __attribute__((section (s))) #ifdef __GNUC__ -#define INIT_FUNCTION PLACE_IN_SECTION("INIT") +#define INIT_FUNCTION #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #else From 6baacb986ba6c1ed03d300d00eabdfcd305b1c71 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 20 Nov 2010 15:53:18 +0000 Subject: [PATCH 040/132] [NTOSKRNL] Get back INIT_FUNCTION on lassy's polite request. svn path=/trunk/; revision=49665 --- reactos/ntoskrnl/include/internal/ntoskrnl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index ceb4800423f..e4b8bd6b9ab 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -5,7 +5,7 @@ */ #define PLACE_IN_SECTION(s) __attribute__((section (s))) #ifdef __GNUC__ -#define INIT_FUNCTION +#define INIT_FUNCTION PLACE_IN_SECTION("INIT") #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #else From fc65d4400f5075e993787b8bc6c1840ad59bfc7e Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 20 Nov 2010 22:05:42 +0000 Subject: [PATCH 041/132] [NTDLL] - Fix LdrVerifyImageMatchesChecksum() prototype. svn path=/trunk/; revision=49676 --- reactos/dll/ntdll/ldr/utils.c | 6 +++--- reactos/include/ndk/umfuncs.h | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/reactos/dll/ntdll/ldr/utils.c b/reactos/dll/ntdll/ldr/utils.c index 1cfb8c85505..4b085391e92 100644 --- a/reactos/dll/ntdll/ldr/utils.c +++ b/reactos/dll/ntdll/ldr/utils.c @@ -3236,9 +3236,9 @@ LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders) */ NTSTATUS NTAPI LdrVerifyImageMatchesChecksum (IN HANDLE FileHandle, - ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3) + IN PLDR_CALLBACK Callback, + IN PVOID CallbackContext, + OUT PUSHORT ImageCharacterstics) { FILE_STANDARD_INFORMATION FileInfo; IO_STATUS_BLOCK IoStatusBlock; diff --git a/reactos/include/ndk/umfuncs.h b/reactos/include/ndk/umfuncs.h index 4cbee159ca7..a3721733e3a 100644 --- a/reactos/include/ndk/umfuncs.h +++ b/reactos/include/ndk/umfuncs.h @@ -295,13 +295,14 @@ LdrUnloadDll( IN PVOID BaseAddress ); +typedef VOID NTAPI (*PLDR_CALLBACK)(PVOID CallbackContext, PVOID Name); NTSTATUS NTAPI LdrVerifyImageMatchesChecksum( IN HANDLE FileHandle, - ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3 + IN PLDR_CALLBACK Callback, + IN PVOID CallbackContext, + OUT PUSHORT ImageCharacterstics ); #endif From 2b6a79d9c9a474eface435b40c64252a7464cecb Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 21 Nov 2010 16:04:52 +0000 Subject: [PATCH 042/132] =?UTF-8?q?[NTOSKRNL]=20Previously,=20in=20ReactOS?= =?UTF-8?q?'=20stories:=20ReactOS=20was=20broken=20since=20more=20a=20hund?= =?UTF-8?q?red=20of=20commits=20when=20two=20devs=20decided=20it=20was=20e?= =?UTF-8?q?nough.=20One=20(we=20will=20name=20him=20Timo)=20fixed=20the=20?= =?UTF-8?q?context=20switch.=20The=20second,=20with=20the=20help=20of=20a?= =?UTF-8?q?=20third=20dev=20(Pierre=20&=20Herv=C3=A9)=20decided=20to=20run?= =?UTF-8?q?=20tests=20by=20disabling=20some=20stuff=20(ie=20INIT=5FFUNCTIO?= =?UTF-8?q?N).=20This=20magically=20made=20testbot=20going=20back=20to=20l?= =?UTF-8?q?ife.=20But,=20some=20complains=20came=20from=20the=20ML,=20so?= =?UTF-8?q?=20trying=20to=20appease=20world,=20Pierre=20decided=20to=20rev?= =?UTF-8?q?ert=20half=20of=20his=20changes,=20thinking=20this=20would=20be?= =?UTF-8?q?=20OK.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~~ Now, after a night. It appears that half revert was a pretty bad idea. Testbot keeps being broken. So, this commit reverts r49665 (which was half reverting r49662). That way, testbot should be back, able to run tests. BUT, due to a NPFS issue, some tests are broken. Eric has been nicely mailed about that issue, with an idea of fix (thanks go here to Aleksey). ~~ For those who like that, drama to follow on ML. I turn into being S/M... svn path=/trunk/; revision=49691 --- reactos/ntoskrnl/include/internal/ntoskrnl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index e4b8bd6b9ab..ceb4800423f 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -5,7 +5,7 @@ */ #define PLACE_IN_SECTION(s) __attribute__((section (s))) #ifdef __GNUC__ -#define INIT_FUNCTION PLACE_IN_SECTION("INIT") +#define INIT_FUNCTION #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #else From 8b5175e0abc1ba98981bb17e40d7e7a6fd7fba8f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 21 Nov 2010 23:15:11 +0000 Subject: [PATCH 043/132] [NPFS/KERNEL32] Switch back to the old pipe wait code but keep the new code in place (disabled). svn path=/trunk/; revision=49701 --- reactos/dll/win32/kernel32/file/npipe.c | 101 +++++++++++++++++++++- reactos/drivers/filesystems/npfs/create.c | 26 ++++-- reactos/drivers/filesystems/npfs/fsctrl.c | 18 +++- 3 files changed, 137 insertions(+), 8 deletions(-) diff --git a/reactos/dll/win32/kernel32/file/npipe.c b/reactos/dll/win32/kernel32/file/npipe.c index 7112ffbcbda..629b69b678f 100644 --- a/reactos/dll/win32/kernel32/file/npipe.c +++ b/reactos/dll/win32/kernel32/file/npipe.c @@ -14,7 +14,7 @@ #include DEBUG_CHANNEL(kernel32file); -#define USING_PROPER_NPFS_WAIT_SEMANTICS +//#define USING_PROPER_NPFS_WAIT_SEMANTICS /* FUNCTIONS ****************************************************************/ @@ -264,6 +264,16 @@ WaitNamedPipeA(LPCSTR lpNamedPipeName, } +/* + * When NPFS will work properly, use this code instead. It is compatible with + * Microsoft's NPFS.SYS. The main difference is that: + * - This code actually respects the timeout instead of ignoring it! + * - This code validates and creates the proper names for both UNC and local pipes + * - On NT, you open the *root* pipe directory (either \DosDevices\Pipe or + * \DosDevices\Unc\Server\Pipe) and then send the pipe to wait on in the + * FILE_PIPE_WAIT_FOR_BUFFER structure. + */ +#ifdef USING_PROPER_NPFS_WAIT_SEMANTICS /* * @implemented */ @@ -448,6 +458,95 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, /* Success */ return TRUE; } +#else +/* + * @implemented + */ +BOOL +WINAPI +WaitNamedPipeW(LPCWSTR lpNamedPipeName, + DWORD nTimeOut) +{ + UNICODE_STRING NamedPipeName; + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + FILE_PIPE_WAIT_FOR_BUFFER WaitPipe; + HANDLE FileHandle; + IO_STATUS_BLOCK Iosb; + + if (RtlDosPathNameToNtPathName_U(lpNamedPipeName, + &NamedPipeName, + NULL, + NULL) == FALSE) + { + return FALSE; + } + + InitializeObjectAttributes(&ObjectAttributes, + &NamedPipeName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenFile(&FileHandle, + FILE_READ_ATTRIBUTES | SYNCHRONIZE, + &ObjectAttributes, + &Iosb, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + RtlFreeUnicodeString(&NamedPipeName); + return FALSE; + } + + /* Check what timeout we got */ + if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT) + { + /* Don't use a timeout */ + WaitPipe.TimeoutSpecified = FALSE; + } + else + { + /* Check if we should wait forever */ + if (nTimeOut == NMPWAIT_WAIT_FOREVER) + { + /* Set the max */ + WaitPipe.Timeout.LowPart = 0; + WaitPipe.Timeout.HighPart = 0x80000000; + } + else + { + /* Convert to NT format */ + WaitPipe.Timeout.QuadPart = UInt32x32To64(-10000, nTimeOut); + } + + /* In both cases, we do have a timeout */ + WaitPipe.TimeoutSpecified = TRUE; + } + + Status = NtFsControlFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + FSCTL_PIPE_WAIT, + &WaitPipe, + sizeof(WaitPipe), + NULL, + 0); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + RtlFreeUnicodeString(&NamedPipeName); + return FALSE; + } + + RtlFreeUnicodeString(&NamedPipeName); + return TRUE; +} +#endif /* diff --git a/reactos/drivers/filesystems/npfs/create.c b/reactos/drivers/filesystems/npfs/create.c index 0462003f97e..dbcbaa1bd73 100644 --- a/reactos/drivers/filesystems/npfs/create.c +++ b/reactos/drivers/filesystems/npfs/create.c @@ -13,6 +13,8 @@ #define NDEBUG #include +//#define USING_PROPER_NPFS_WAIT_SEMANTICS + /* FUNCTIONS *****************************************************************/ PNPFS_FCB @@ -146,6 +148,9 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, PNPFS_VCB Vcb; ACCESS_MASK DesiredAccess; NTSTATUS Status; +#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS + BOOLEAN SpecialAccess; +#endif DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp); @@ -161,6 +166,14 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, Irp->IoStatus.Information = 0; +#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS + SpecialAccess = ((DesiredAccess & SPECIFIC_RIGHTS_ALL) == FILE_READ_ATTRIBUTES); + if (SpecialAccess) + { + DPRINT("NpfsCreate() open client end for special use!\n"); + } +#endif + if (FileName->Length == 2 && FileName->Buffer[0] == L'\\' && RelatedFileObject == NULL) { DPRINT("Open the root directory\n"); @@ -217,8 +230,11 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, ClientCcb->Fcb = Fcb; ClientCcb->PipeEnd = FILE_PIPE_CLIENT_END; ClientCcb->OtherSide = NULL; -// ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; +#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS + ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; +#else ClientCcb->PipeState = FILE_PIPE_DISCONNECTED_STATE; +#endif InitializeListHead(&ClientCcb->ReadRequestListHead); DPRINT("CCB: %p\n", ClientCcb); @@ -256,10 +272,10 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* * Step 3. Search for listening server CCB. */ -/* +#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS if (!SpecialAccess) { -*/ +#endif /* * WARNING: Point of no return! Once we get the server CCB it's * possible that we completed a wait request and so we have to @@ -315,7 +331,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */ NpfsSignalAndRemoveListeningServerInstance(Fcb, ServerCcb); } -/* +#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS } else if (IsListEmpty(&Fcb->ServerCcbListHead)) { @@ -333,7 +349,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_UNSUCCESSFUL; } -*/ +#endif /* * Step 4. Add the client CCB to a list and connect it if possible. diff --git a/reactos/drivers/filesystems/npfs/fsctrl.c b/reactos/drivers/filesystems/npfs/fsctrl.c index c177969f850..9055bb1f902 100644 --- a/reactos/drivers/filesystems/npfs/fsctrl.c +++ b/reactos/drivers/filesystems/npfs/fsctrl.c @@ -15,6 +15,8 @@ #define NDEBUG #include +//#define USING_PROPER_NPFS_WAIT_SEMANTICS + /* FUNCTIONS *****************************************************************/ static DRIVER_CANCEL NpfsListeningCancelRoutine; @@ -293,18 +295,21 @@ NpfsWaitPipe(PIRP Irp, PNPFS_CCB Ccb) { PLIST_ENTRY current_entry; - PNPFS_VCB Vcb; PNPFS_FCB Fcb; PNPFS_CCB ServerCcb; PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; LARGE_INTEGER TimeOut; - UNICODE_STRING PipeName; NTSTATUS Status; +#ifdef USING_PROPER_NPFS_WAIT_SEMANTICS + PNPFS_VCB Vcb; + UNICODE_STRING PipeName; +#endif DPRINT("NpfsWaitPipe\n"); WaitPipe = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer; +#ifdef USING_PROPER_NPFS_WAIT_SEMANTICS /* Fail, if the CCB does not represent the root directory */ if (Ccb->Type != CCB_DIRECTORY) return STATUS_ILLEGAL_FUNCTION; @@ -352,6 +357,15 @@ NpfsWaitPipe(PIRP Irp, } DPRINT("Fcb %p\n", Fcb); +#else + Fcb = Ccb->Fcb; + + if (Ccb->PipeState != 0) + { + DPRINT("Pipe is not in passive (waiting) state!\n"); + return STATUS_UNSUCCESSFUL; + } +#endif /* search for listening server */ current_entry = Fcb->ServerCcbListHead.Flink; From 9b693d8c6901c2a1d442f00a25ff16870d7ce4b0 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Mon, 22 Nov 2010 20:10:56 +0000 Subject: [PATCH 044/132] [win32k] - Fix one of the greatest hacks in message handling: do not wake up every message queue when there is mouse or keyboard input ( wake only the thread that must take input) - rewrite co_WinPosWindowFromPoint, co_MsqInsertMouseMessage and co_MsqPeekHardwareMessage - port co_IntProcessMouseMessage and MsqSendParentNotify from wine - call co_IntProcessHardwareMessage from co_MsqPeekHardwareMessage, and not from co_IntPeekMessage - move co_IntProcessHardwareMessage, co_IntProcessKeyboardMessage and co_IntProcessMouseMessage to msgqueue.c svn path=/trunk/; revision=49710 --- .../win32/win32k/include/msgqueue.h | 35 +- .../subsystems/win32/win32k/include/winpos.h | 5 +- .../subsystems/win32/win32k/ntuser/message.c | 407 +------ .../subsystems/win32/win32k/ntuser/msgqueue.c | 1044 ++++++++--------- .../subsystems/win32/win32k/ntuser/window.c | 3 +- .../subsystems/win32/win32k/ntuser/winpos.c | 199 ++-- 6 files changed, 573 insertions(+), 1120 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 621195ca562..6bda51dc7ed 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -58,8 +58,12 @@ typedef struct _USER_MESSAGE_QUEUE LIST_ENTRY HardwareMessagesListHead; /* Lock for the hardware message list. */ KMUTEX HardwareLock; - /* Pointer to the current WM_MOUSEMOVE message */ - PUSER_MESSAGE MouseMoveMsg; + /* True if a WM_MOUSEMOVE is pending */ + BOOLEAN MouseMoved; + /* Current WM_MOUSEMOVE message */ + MSG MouseMoveMsg; + /* Last click message for translating double clicks */ + MSG msgDblClk; /* True if a WM_QUIT message is pending. */ BOOLEAN QuitPosted; /* The quit exit code. */ @@ -122,18 +126,25 @@ VOID FASTCALL MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode); BOOLEAN APIENTRY MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, - IN BOOLEAN Remove, - IN PWND Window, - IN UINT MsgFilterLow, - IN UINT MsgFilterHigh, - OUT PMSG Message); + IN BOOLEAN Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT PMSG Message); BOOL APIENTRY co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, - IN BOOL Remove, - IN PWND Window, - IN UINT MsgFilterLow, - IN UINT MsgFilterHigh, - OUT MSG* pMsg); + IN BOOL Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT MSG* pMsg); +BOOL APIENTRY +co_MsqPeekMouseMove(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOL Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT MSG* pMsg); BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue); VOID FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/winpos.h b/reactos/subsystems/win32/win32k/include/winpos.h index cee93ab0465..b21b9107616 100644 --- a/reactos/subsystems/win32/win32k/include/winpos.h +++ b/reactos/subsystems/win32/win32k/include/winpos.h @@ -27,9 +27,8 @@ BOOLEAN FASTCALL co_WinPosShowWindow(PWND Window, INT Cmd); void FASTCALL co_WinPosSendSizeMove(PWND Window); -USHORT FASTCALL -co_WinPosWindowFromPoint(PWND ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint, - PWND* Window); +PWND FASTCALL +co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest); VOID FASTCALL co_WinPosActivateOtherWindow(PWND Window); VOID FASTCALL WinPosInitInternalPos(PWND WindowObject, diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 8cabf9fbdf2..89ad044b9e1 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -502,387 +502,6 @@ IntDispatchMessage(PMSG pMsg) return retval; } -VOID FASTCALL -co_IntSendHitTestMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg) -{ - if(!Msg->hwnd || ThreadQueue->CaptureWindow) - { - return; - } - - switch(Msg->message) - { - case WM_MOUSEMOVE: - { - co_IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message)); - break; - } - case WM_NCMOUSEMOVE: - { - co_IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message)); - break; - } - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_XBUTTONDOWN: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - case WM_XBUTTONDBLCLK: - { - WPARAM wParam; - PSYSTEM_CURSORINFO CurInfo; - CurInfo = IntGetSysCursorInfo(); - - wParam = (WPARAM)(CurInfo->ButtonsDown); - - co_IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam); - co_IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message)); - break; - } - case WM_NCLBUTTONDOWN: - case WM_NCMBUTTONDOWN: - case WM_NCRBUTTONDOWN: - case WM_NCXBUTTONDOWN: - case WM_NCLBUTTONDBLCLK: - case WM_NCMBUTTONDBLCLK: - case WM_NCRBUTTONDBLCLK: - case WM_NCXBUTTONDBLCLK: - { - co_IntSendMessage(Msg->hwnd, WM_NCMOUSEMOVE, (WPARAM)Msg->wParam, Msg->lParam); - co_IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message)); - break; - } - } -} - -BOOL FASTCALL -co_IntActivateWindowMouse( PUSER_MESSAGE_QUEUE ThreadQueue, - LPMSG Msg, - PWND MsgWindow, - USHORT *HitTest) -{ - ULONG Result; - PWND Parent; - - ASSERT_REFS_CO(MsgWindow); - - if(*HitTest == (USHORT)HTTRANSPARENT) - { - /* eat the message, search again! */ - return TRUE; - } - - Parent = IntGetParent(MsgWindow);//fixme: deref retval? - - /* If no parent window, pass MsgWindows HWND as wParam. Fixes bug #3111 */ - Result = co_IntSendMessage(MsgWindow->head.h, - WM_MOUSEACTIVATE, - (WPARAM) (Parent ? Parent->head.h : MsgWindow->head.h), - (LPARAM)MAKELONG(*HitTest, Msg->message) - ); - - switch (Result) - { - case MA_NOACTIVATEANDEAT: - return TRUE; - case MA_NOACTIVATE: - break; - case MA_ACTIVATEANDEAT: - co_IntMouseActivateWindow(MsgWindow); - return TRUE; - default: - /* MA_ACTIVATE */ - co_IntMouseActivateWindow(MsgWindow); - break; - } - - return FALSE; -} - -BOOL FASTCALL -co_IntTranslateMouseMessage( PUSER_MESSAGE_QUEUE ThreadQueue, - LPMSG Msg, - USHORT *HitTest, - BOOL Remove) -{ - PWND Window; - USER_REFERENCE_ENTRY Ref, DesktopRef; - - if(!(Window = UserGetWindowObject(Msg->hwnd))) - { - /* let's just eat the message?! */ - return TRUE; - } - - *HitTest = HTCLIENT; - - UserRefObjectCo(Window, &Ref); - - if ( ThreadQueue == Window->head.pti->MessageQueue && - ThreadQueue->CaptureWindow != Window->head.h) - { - /* only send WM_NCHITTEST messages if we're not capturing the window! */ - if (Remove ) - { - *HitTest = co_IntSendMessage(Window->head.h, WM_NCHITTEST, 0, - MAKELONG(Msg->pt.x, Msg->pt.y)); - } - /* else we are going to see this message again, but then with Remove == TRUE */ - - if (*HitTest == (USHORT)HTTRANSPARENT) - { - PWND DesktopWindow; - HWND hDesktop = IntGetDesktopWindow(); - - if ((DesktopWindow = UserGetWindowObject(hDesktop))) - { - PWND Wnd; - - UserRefObjectCo(DesktopWindow, &DesktopRef); - - co_WinPosWindowFromPoint(DesktopWindow, Window->head.pti->MessageQueue, &Msg->pt, &Wnd); - if (Wnd) - { - if (Wnd != Window) - { - /* post the message to the other window */ - Msg->hwnd = Wnd->head.h; - if(!(Wnd->state & WNDS_DESTROYED)) - { - MsqPostMessage(Wnd->head.pti->MessageQueue, Msg, FALSE, - Msg->message == WM_MOUSEMOVE ? QS_MOUSEMOVE : - QS_MOUSEBUTTON); - } - - /* eat the message */ - UserDereferenceObject(Wnd); - UserDerefObjectCo(DesktopWindow); - UserDerefObjectCo(Window); - return TRUE; - } - UserDereferenceObject(Wnd); - } - - UserDerefObjectCo(DesktopWindow); - } - } - } - - if ( gspv.bMouseClickLock && - ((Msg->message == WM_LBUTTONUP) || - (Msg->message == WM_LBUTTONDOWN) ) ) - { - if (MsqIsClkLck(Msg, Remove)) - { - // FIXME: drop the message, hack: use WM_NULL - Msg->message = WM_NULL; - } - } - - if (IS_BTN_MESSAGE(Msg->message, DOWN)) - { - /* generate double click messages, if necessary */ - if ((((*HitTest) != HTCLIENT) || - (Window->pcls->style & CS_DBLCLKS)) && - MsqIsDblClk(Msg, Remove)) - { - Msg->message += WM_LBUTTONDBLCLK - WM_LBUTTONDOWN; - } - } - - if(Msg->message != WM_MOUSEWHEEL) - { - - if ((*HitTest) != HTCLIENT) - { - Msg->message += WM_NCMOUSEMOVE - WM_MOUSEMOVE; - if ( (Msg->message == WM_NCRBUTTONUP) && - (((*HitTest) == HTCAPTION) || ((*HitTest) == HTSYSMENU)) ) - { - Msg->message = WM_CONTEXTMENU; - Msg->wParam = (WPARAM)Window->head.h; - } - else - { - Msg->wParam = *HitTest; - } - Msg->lParam = MAKELONG(Msg->pt.x, Msg->pt.y); - } - else if ( ThreadQueue->MoveSize == NULL && - ThreadQueue->MenuOwner == NULL ) - { - /* NOTE: Msg->pt should remain in screen coordinates. -- FiN */ - Msg->lParam = MAKELONG( - Msg->pt.x - (WORD)Window->rcClient.left, - Msg->pt.y - (WORD)Window->rcClient.top); - } - } - - UserDerefObjectCo(Window); - return FALSE; -} - -BOOL ProcessMouseMessage(MSG* Msg, BOOLEAN RemoveMessages) -{ - MOUSEHOOKSTRUCT MHook; - EVENTMSG Event; - PTHREADINFO pti; - PUSER_MESSAGE_QUEUE ThreadQueue; - USER_REFERENCE_ENTRY Ref; - USHORT HitTest = HTNOWHERE; - - pti = PsGetCurrentThreadWin32Thread(); - ThreadQueue = pti->MessageQueue; - - if(RemoveMessages) - { - PWND MsgWindow = NULL; - - /* Mouse message process */ - - if( Msg->hwnd && - ( MsgWindow = UserGetWindowObject(Msg->hwnd) ) && - Msg->message >= WM_MOUSEFIRST && - Msg->message <= WM_MOUSELAST ) - { - USHORT HitTest; - - UserRefObjectCo(MsgWindow, &Ref); - - if ( co_IntTranslateMouseMessage( ThreadQueue, - Msg, - &HitTest, - TRUE)) - /* FIXME - check message filter again, if the message doesn't match anymore, - search again */ - { - UserDerefObjectCo(MsgWindow); - /* eat the message, search again */ - return FALSE; - } - - if(ThreadQueue->CaptureWindow == NULL) - { - co_IntSendHitTestMessages(ThreadQueue, Msg); - - if ( ( Msg->message != WM_MOUSEMOVE && - Msg->message != WM_NCMOUSEMOVE ) && - IS_BTN_MESSAGE(Msg->message, DOWN) && - co_IntActivateWindowMouse(ThreadQueue, Msg, MsgWindow, &HitTest) ) - { - UserDerefObjectCo(MsgWindow); - /* eat the message, search again */ - return FALSE; - } - } - - UserDerefObjectCo(MsgWindow); - } - else - { - co_IntSendHitTestMessages(ThreadQueue, Msg); - } - - return TRUE; - } - - if ( ( Msg->hwnd && - Msg->message >= WM_MOUSEFIRST && - Msg->message <= WM_MOUSELAST ) && - co_IntTranslateMouseMessage( ThreadQueue, - Msg, - &HitTest, - FALSE) ) - /* FIXME - check message filter again, if the message doesn't match anymore, - search again */ - { - /* eat the message, search again */ - return FALSE; - } - - pti->rpdesk->htEx = HitTest; /* Now set the capture hit. */ - - Event.message = Msg->message; - Event.time = Msg->time; - Event.hwnd = Msg->hwnd; - Event.paramL = Msg->pt.x; - Event.paramH = Msg->pt.y; - co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&Event); - - - MHook.pt = Msg->pt; - MHook.hwnd = Msg->hwnd; - MHook.wHitTestCode = HitTest; - MHook.dwExtraInfo = 0; - if (co_HOOK_CallHooks( WH_MOUSE, - RemoveMessages ? HC_ACTION : HC_NOREMOVE, - Msg->message, - (LPARAM)&MHook )) - { - MHook.pt = Msg->pt; - MHook.hwnd = Msg->hwnd; - MHook.wHitTestCode = HitTest; - MHook.dwExtraInfo = 0; - co_HOOK_CallHooks( WH_CBT, - HCBT_CLICKSKIPPED, - Msg->message, - (LPARAM)&MHook); - DPRINT1("MouseMessage WH_CBT Call Hook return!\n"); - return FALSE; - } - - return TRUE; -} - -BOOL ProcessKeyboardMessage(MSG* Msg, BOOLEAN RemoveMessages) -{ - EVENTMSG Event; - - Event.message = Msg->message; - Event.hwnd = Msg->hwnd; - Event.time = Msg->time; - Event.paramL = (Msg->wParam & 0xFF) | (HIWORD(Msg->lParam) << 8); - Event.paramH = Msg->lParam & 0x7FFF; - if (HIWORD(Msg->lParam) & 0x0100) Event.paramH |= 0x8000; - co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&Event); - - if (co_HOOK_CallHooks( WH_KEYBOARD, - RemoveMessages ? HC_ACTION : HC_NOREMOVE, - LOWORD(Msg->wParam), - Msg->lParam)) - { - /* skip this message */ - co_HOOK_CallHooks( WH_CBT, - HCBT_KEYSKIPPED, - LOWORD(Msg->wParam), - Msg->lParam ); - DPRINT1("KeyboardMessage WH_CBT Call Hook return!\n"); - return FALSE; - } - return TRUE; -} - -BOOL ProcessHardwareMessage(MSG* Msg, BOOLEAN RemoveMessages) -{ - if ( IS_MOUSE_MESSAGE(Msg->message)) - { - if (!ProcessMouseMessage(Msg, RemoveMessages)) - { - return FALSE; - } - } - else if ( IS_KBD_MESSAGE(Msg->message)) - { - if(!ProcessKeyboardMessage(Msg, RemoveMessages)) - { - return FALSE; - } - } - - return TRUE; -} /* * Internal version of PeekMessage() doing all the work */ @@ -933,27 +552,33 @@ co_IntPeekMessage( PMSG Msg, /* Now check for normal messages. */ if (MsqPeekMessage( ThreadQueue, - RemoveMessages, - Window, - MsgFilterMin, - MsgFilterMax, - Msg )) + RemoveMessages, + Window, + MsgFilterMin, + MsgFilterMax, + Msg )) { return TRUE; } /* Check for hardware events. */ - if(co_MsqPeekHardwareMessage( ThreadQueue, + if(co_MsqPeekMouseMove(ThreadQueue, + RemoveMessages, + Window, + MsgFilterMin, + MsgFilterMax, + Msg )) + { + return TRUE; + } + + if(co_MsqPeekHardwareMessage(ThreadQueue, RemoveMessages, Window, MsgFilterMin, MsgFilterMax, Msg)) { - - if(!ProcessHardwareMessage(Msg, RemoveMessages)) - continue; - return TRUE; } diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index f705aed4e2a..d4a7f22401a 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -22,6 +22,8 @@ * PURPOSE: Message queues * FILE: subsystems/win32/win32k/ntuser/msgqueue.c * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net) + Alexandre Julliard + Maarten Lankhorst * REVISION HISTORY: * 06-06-2001 CSH Created */ @@ -35,31 +37,8 @@ /* GLOBALS *******************************************************************/ -#define SYSTEM_MESSAGE_QUEUE_SIZE (256) - -static MSG SystemMessageQueue[SYSTEM_MESSAGE_QUEUE_SIZE]; -static ULONG SystemMessageQueueHead = 0; -static ULONG SystemMessageQueueTail = 0; -static ULONG SystemMessageQueueCount = 0; -static KSPIN_LOCK SystemMessageQueueLock; - -static ULONG volatile HardwareMessageQueueStamp = 0; -static LIST_ENTRY HardwareMessageQueueHead; -static KMUTANT HardwareMessageQueueLock; - -static KEVENT HardwareMessageEvent; - static PAGED_LOOKASIDE_LIST MessageLookasideList; -#define IntLockSystemMessageQueue(OldIrql) \ - KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql) - -#define IntUnLockSystemMessageQueue(OldIrql) \ - KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql) - -#define IntUnLockSystemHardwareMessageQueueLock(Wait) \ - KeReleaseMutant(&HardwareMessageQueueLock, IO_NO_INCREMENT, FALSE, Wait) - /* FUNCTIONS *****************************************************************/ HANDLE FASTCALL @@ -135,12 +114,6 @@ NTSTATUS NTAPI MsqInitializeImpl(VOID) { - /*CurrentFocusMessageQueue = NULL;*/ - InitializeListHead(&HardwareMessageQueueHead); - KeInitializeEvent(&HardwareMessageEvent, NotificationEvent, 0); - KeInitializeSpinLock(&SystemMessageQueueLock); - KeInitializeMutant(&HardwareMessageQueueLock, 0); - ExInitializePagedLookasideList(&MessageLookasideList, NULL, NULL, @@ -152,13 +125,20 @@ MsqInitializeImpl(VOID) return(STATUS_SUCCESS); } +VOID FASTCALL +MsqPostMouseMove(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg) +{ + MessageQueue->MouseMoveMsg = *Msg; + MessageQueue->MouseMoved = TRUE; + MsqWakeQueue(MessageQueue, QS_MOUSEMOVE); +} + VOID FASTCALL co_MsqInsertMouseMessage(MSG* Msg) { LARGE_INTEGER LargeTickCount; - KIRQL OldIrql; - ULONG Prev; MSLLHOOKSTRUCT MouseHookData; + PWND pwnd, pwndDesktop; KeQueryTickCount(&LargeTickCount); Msg->time = MsqCalculateMessageTime(&LargeTickCount); @@ -191,556 +171,47 @@ co_MsqInsertMouseMessage(MSG* Msg) if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData)) return; - /* - * If we got WM_MOUSEMOVE and there are already messages in the - * system message queue, check if the last message is mouse move - * and if it is then just overwrite it. - */ - IntLockSystemMessageQueue(OldIrql); + /* Get the desktop window */ + pwndDesktop = UserGetDesktopWindow(); + if(!pwndDesktop) + return; - /* - * Bail out if the queue is full. FIXME: We should handle this case - * more gracefully. - */ - - if (SystemMessageQueueCount == SYSTEM_MESSAGE_QUEUE_SIZE) + /* Check if the mouse is captured */ + Msg->hwnd = IntGetCaptureWindow(); + if(Msg->hwnd != NULL) { - IntUnLockSystemMessageQueue(OldIrql); - return; - } - - if (Msg->message == WM_MOUSEMOVE && SystemMessageQueueCount) - { - if (SystemMessageQueueTail == 0) - Prev = SYSTEM_MESSAGE_QUEUE_SIZE - 1; - else - Prev = SystemMessageQueueTail - 1; - if (SystemMessageQueue[Prev].message == WM_MOUSEMOVE) - { - SystemMessageQueueTail = Prev; - SystemMessageQueueCount--; - } - } - - /* - * Actually insert the message into the system message queue. - */ - - SystemMessageQueue[SystemMessageQueueTail] = *Msg; - SystemMessageQueueTail = - (SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE; - SystemMessageQueueCount++; - - IntUnLockSystemMessageQueue(OldIrql); - - KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE); -} - -BOOL FASTCALL -MsqIsClkLck(LPMSG Msg, BOOL Remove) -{ - PTHREADINFO pti; - PSYSTEM_CURSORINFO CurInfo; - BOOL Res = FALSE; - - pti = PsGetCurrentThreadWin32Thread(); - if (pti->rpdesk == NULL) - { - return FALSE; - } - - CurInfo = IntGetSysCursorInfo(); - - switch (Msg->message) - { - case WM_LBUTTONUP: - Res = ((Msg->time - CurInfo->ClickLockTime) >= gspv.dwMouseClickLockTime); - if (Res && (!CurInfo->ClickLockActive)) - { - CurInfo->ClickLockActive = TRUE; - } - break; - case WM_LBUTTONDOWN: - if (CurInfo->ClickLockActive) - { - Res = TRUE; - CurInfo->ClickLockActive = FALSE; - CurInfo->ClickLockTime = 0; - } - else - { - CurInfo->ClickLockTime = Msg->time; - } - break; - } - return Res; -} - -BOOL FASTCALL -MsqIsDblClk(LPMSG Msg, BOOL Remove) -{ - PTHREADINFO pti; - PSYSTEM_CURSORINFO CurInfo; - LONG dX, dY; - BOOL Res; - - pti = PsGetCurrentThreadWin32Thread(); - if (pti->rpdesk == NULL) - { - return FALSE; - } - - CurInfo = IntGetSysCursorInfo(); - Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) && - ((Msg->time - CurInfo->LastBtnDown) < gspv.iDblClickTime); - if(Res) - { - - dX = CurInfo->LastBtnDownX - Msg->pt.x; - dY = CurInfo->LastBtnDownY - Msg->pt.y; - if(dX < 0) - dX = -dX; - if(dY < 0) - dY = -dY; - - Res = (dX <= gspv.iDblClickWidth) && - (dY <= gspv.iDblClickHeight); - - if(Res) - { - if(CurInfo->ButtonsDown) - Res = (CurInfo->ButtonsDown == Msg->message); - } - } - - if(Remove) - { - CurInfo->LastBtnDownX = Msg->pt.x; - CurInfo->LastBtnDownY = Msg->pt.y; - CurInfo->ButtonsDown = Msg->message; - if (Res) - { - CurInfo->LastBtnDown = 0; - CurInfo->LastClkWnd = NULL; - } - else - { - CurInfo->LastClkWnd = (HANDLE)Msg->hwnd; - CurInfo->LastBtnDown = Msg->time; - } - } - - return Res; -} - -static BOOL APIENTRY -co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT FilterLow, UINT FilterHigh, - PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed, - PWND ScopeWin, PPOINT ScreenPoint, BOOL FromGlobalQueue, PLIST_ENTRY *Next) -{ - USHORT Msg = Message->Msg.message; - PWND CaptureWindow = NULL; - HWND hCaptureWin; - - /* FIXME: Mouse message can be sent before the Desktop is up and running in which case ScopeWin (Desktop) is 0. - Is this the best fix? */ - if (ScopeWin == 0) return FALSE; - - ASSERT_REFS_CO(ScopeWin); - - /* - co_WinPosWindowFromPoint can return a Window, and in that case - that window has a ref that we need to deref. Thats why we add "dummy" - refs in all other cases. - */ - - hCaptureWin = IntGetCaptureWindow(); - if (hCaptureWin == NULL) - { - if (Msg == WM_MOUSEWHEEL) - { - CaptureWindow = UserGetWindowObject(IntGetFocusWindow()); - if (CaptureWindow) UserReferenceObject(CaptureWindow); - } - else - { - co_WinPosWindowFromPoint(ScopeWin, NULL, &Message->Msg.pt, &CaptureWindow); - if(CaptureWindow == NULL) - { - CaptureWindow = ScopeWin; - if (CaptureWindow) UserReferenceObject(CaptureWindow); - } - else - { - /* this is the one case where we dont add a ref, since the returned - window is already referenced */ - } - } + pwnd = UserGetWindowObject(Msg->hwnd); } else { - /* FIXME - window messages should go to the right window if no buttons are - pressed */ - CaptureWindow = UserGetWindowObject(hCaptureWin); - if (CaptureWindow) UserReferenceObject(CaptureWindow); + /* Loop all top level windows to find which one should receive input */ + for( pwnd = pwndDesktop->spwndChild; + pwnd != NULL; + pwnd = pwnd->spwndNext ) + { + if((pwnd->style & WS_VISIBLE) && + IntPtInWindow(pwnd, Msg->pt.x, Msg->pt.y)) + { + Msg->hwnd = pwnd->head.h; + break; + } + } } - - - if (CaptureWindow == NULL) + /* Check if we found a window */ + if(Msg->hwnd != NULL && pwnd != NULL) { - if(!FromGlobalQueue) - { - RemoveEntryList(&Message->ListEntry); - if(MessageQueue->MouseMoveMsg == Message) - { - MessageQueue->MouseMoveMsg = NULL; - } - } - // when FromGlobalQueue is true, the caller has already removed the Message - ExFreePool(Message); - *Freed = TRUE; - return(FALSE); + if(Msg->message == WM_MOUSEMOVE) + { + /* Mouse move is a special case*/ + MsqPostMouseMove(pwnd->head.pti->MessageQueue, Msg); + } + else + { + DPRINT("Posting mouse message to hwnd=0x%x!\n", UserHMGetHandle(pwnd)); + MsqPostMessage(pwnd->head.pti->MessageQueue, Msg, TRUE, QS_MOUSEBUTTON); + } } - - if (CaptureWindow->head.pti->MessageQueue != MessageQueue) - { - if (! FromGlobalQueue) - { - DPRINT("Moving msg between private queues\n"); - /* This message is already queued in a private queue, but we need - * to move it to a different queue, perhaps because a new window - * was created which now covers the screen area previously taken - * by another window. To move it, we need to take it out of the - * old queue. Note that we're already holding the lock mutexes of the - * old queue */ - RemoveEntryList(&Message->ListEntry); - - /* remove the pointer for the current WM_MOUSEMOVE message in case we - just removed it */ - if(MessageQueue->MouseMoveMsg == Message) - { - MessageQueue->MouseMoveMsg = NULL; - } - } - - /* lock the destination message queue, so we don't get in trouble with other - threads, messing with it at the same time */ - IntLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - InsertTailList(&CaptureWindow->head.pti->MessageQueue->HardwareMessagesListHead, - &Message->ListEntry); - if(Message->Msg.message == WM_MOUSEMOVE) - { - if(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg) - { - /* remove the old WM_MOUSEMOVE message, we're processing a more recent - one */ - RemoveEntryList(&CaptureWindow->head.pti->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg); - } - /* save the pointer to the WM_MOUSEMOVE message in the new queue */ - CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = Message; - - MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEMOVE); - } - else - { - MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEBUTTON); - } - IntUnLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - - *Freed = FALSE; - UserDereferenceObject(CaptureWindow); - return(FALSE); - } - - /* From here on, we're in the same message queue as the caller! */ - - *ScreenPoint = Message->Msg.pt; - - if((Window != NULL && PtrToInt(Window) != 1 && CaptureWindow->head.h != Window->head.h) || - ((FilterLow != 0 || FilterHigh != 0) && (Msg < FilterLow || Msg > FilterHigh))) - { - /* Reject the message because it doesn't match the filter */ - - if(FromGlobalQueue) - { - /* Lock the message queue so no other thread can mess with it. - Our own message queue is not locked while fetching from the global - queue, so we have to make sure nothing interferes! */ - IntLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - /* if we're from the global queue, we need to add our message to our - private queue so we don't loose it! */ - InsertTailList(&CaptureWindow->head.pti->MessageQueue->HardwareMessagesListHead, - &Message->ListEntry); - } - - if (Message->Msg.message == WM_MOUSEMOVE) - { - if(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg && - (CaptureWindow->head.pti->MessageQueue->MouseMoveMsg != Message)) - { - /* delete the old message */ - RemoveEntryList(&CaptureWindow->head.pti->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg); - if (!FromGlobalQueue) - { - // We might have deleted the next one in our queue, so fix next - *Next = Message->ListEntry.Flink; - } - } - /* always save a pointer to this WM_MOUSEMOVE message here because we're - sure that the message is in the private queue */ - CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = Message; - } - if(FromGlobalQueue) - { - IntUnLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - } - - UserDereferenceObject(CaptureWindow); - *Freed = FALSE; - return(FALSE); - } - - /* FIXME - only assign if removing? */ - Message->Msg.hwnd = CaptureWindow->head.h; - Message->Msg.message = Msg; - Message->Msg.lParam = MAKELONG(Message->Msg.pt.x, Message->Msg.pt.y); - - /* remove the reference to the current WM_(NC)MOUSEMOVE message, if this message - is it */ - if (Message->Msg.message == WM_MOUSEMOVE || - Message->Msg.message == WM_NCMOUSEMOVE) - { - if(FromGlobalQueue) - { - /* Lock the message queue so no other thread can mess with it. - Our own message queue is not locked while fetching from the global - queue, so we have to make sure nothing interferes! */ - IntLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - if(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg) - { - /* delete the WM_(NC)MOUSEMOVE message in the private queue, we're dealing - with one that's been sent later */ - RemoveEntryList(&CaptureWindow->head.pti->MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(CaptureWindow->head.pti->MessageQueue->MouseMoveMsg); - /* our message is not in the private queue so we can remove the pointer - instead of setting it to the current message we're processing */ - CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = NULL; - } - IntUnLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue); - } - else if (CaptureWindow->head.pti->MessageQueue->MouseMoveMsg == Message) - { - CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = NULL; - } - } - - UserDereferenceObject(CaptureWindow); - *Freed = FALSE; - return(TRUE); -} - -BOOL APIENTRY -co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, - IN BOOL Remove, - IN PWND Window, - IN UINT FilterLow, - IN UINT FilterHigh, - OUT PMSG Message) -{ - KIRQL OldIrql; - POINT ScreenPoint; - BOOL Accept, Freed; - PLIST_ENTRY CurrentEntry; - PWND DesktopWindow = NULL; - PVOID WaitObjects[2]; - NTSTATUS WaitStatus; - DECLARE_RETURN(BOOL); - USER_REFERENCE_ENTRY Ref; - PDESKTOPINFO Desk = NULL; - - WaitObjects[1] = MessageQueue->NewMessages; - WaitObjects[0] = &HardwareMessageQueueLock; - do - { - UserLeaveCo(); - - WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest, - UserMode, FALSE, NULL, NULL); - - UserEnterCo(); - } - while (NT_SUCCESS(WaitStatus) && STATUS_WAIT_0 != WaitStatus); - - DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); - - if (DesktopWindow) - { - UserRefObjectCo(DesktopWindow, &Ref); - Desk = DesktopWindow->head.pti->pDeskInfo; - } - - /* Process messages in the message queue itself. */ - IntLockHardwareMessageQueue(MessageQueue); - CurrentEntry = MessageQueue->HardwareMessagesListHead.Flink; - while (CurrentEntry != &MessageQueue->HardwareMessagesListHead) - { - PUSER_MESSAGE Current = - CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, ListEntry); - CurrentEntry = CurrentEntry->Flink; - if (Current->Msg.message >= WM_MOUSEFIRST && - Current->Msg.message <= WM_MOUSELAST) - { - - - Accept = co_MsqTranslateMouseMessage(MessageQueue, Window, FilterLow, FilterHigh, - Current, Remove, &Freed, - DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry); - if (Accept) - { - *Message = Current->Msg; - if (Remove) - { - RemoveEntryList(&Current->ListEntry); - MsqDestroyMessage(Current); - } - IntUnLockHardwareMessageQueue(MessageQueue); - IntUnLockSystemHardwareMessageQueueLock(FALSE); - - if (Desk) - Desk->LastInputWasKbd = FALSE; - - RETURN(TRUE); - } - - } - else - { - *Message = Current->Msg; - if (Remove) - { - RemoveEntryList(&Current->ListEntry); - MsqDestroyMessage(Current); - } - IntUnLockHardwareMessageQueue(MessageQueue); - IntUnLockSystemHardwareMessageQueueLock(FALSE); - - RETURN(TRUE); - } - } - IntUnLockHardwareMessageQueue(MessageQueue); - - /* Now try the global queue. */ - - /* Transfer all messages from the DPC accessible queue to the main queue. */ - IntLockSystemMessageQueue(OldIrql); - while (SystemMessageQueueCount > 0) - { - PUSER_MESSAGE UserMsg; - MSG Msg; - - ASSERT(SystemMessageQueueHead < SYSTEM_MESSAGE_QUEUE_SIZE); - Msg = SystemMessageQueue[SystemMessageQueueHead]; - SystemMessageQueueHead = - (SystemMessageQueueHead + 1) % SYSTEM_MESSAGE_QUEUE_SIZE; - SystemMessageQueueCount--; - IntUnLockSystemMessageQueue(OldIrql); - - UserMsg = ExAllocateFromPagedLookasideList(&MessageLookasideList); - /* What to do if out of memory? For now we just panic a bit in debug */ - ASSERT(UserMsg); - UserMsg->Msg = Msg; - InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry); - - IntLockSystemMessageQueue(OldIrql); - } - HardwareMessageQueueStamp++; - IntUnLockSystemMessageQueue(OldIrql); - - /* Process messages in the queue until we find one to return. */ - CurrentEntry = HardwareMessageQueueHead.Flink; - while (CurrentEntry != &HardwareMessageQueueHead) - { - PUSER_MESSAGE Current = - CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, ListEntry); - CurrentEntry = CurrentEntry->Flink; - RemoveEntryList(&Current->ListEntry); - HardwareMessageQueueStamp++; - if (Current->Msg.message >= WM_MOUSEFIRST && - Current->Msg.message <= WM_MOUSELAST) - { - const ULONG ActiveStamp = HardwareMessageQueueStamp; - /* Translate the message. */ - Accept = co_MsqTranslateMouseMessage(MessageQueue, Window, FilterLow, FilterHigh, - Current, Remove, &Freed, - DesktopWindow, &ScreenPoint, TRUE, NULL); - if (Accept) - { - /* Check for no more messages in the system queue. */ - IntLockSystemMessageQueue(OldIrql); - if (SystemMessageQueueCount == 0 && - IsListEmpty(&HardwareMessageQueueHead)) - { - KeClearEvent(&HardwareMessageEvent); - } - IntUnLockSystemMessageQueue(OldIrql); - - /* - If we aren't removing the message then add it to the private - queue. - */ - if (!Remove) - { - IntLockHardwareMessageQueue(MessageQueue); - if(Current->Msg.message == WM_MOUSEMOVE) - { - if(MessageQueue->MouseMoveMsg) - { - RemoveEntryList(&MessageQueue->MouseMoveMsg->ListEntry); - ExFreePool(MessageQueue->MouseMoveMsg); - } - MessageQueue->MouseMoveMsg = Current; - } - InsertTailList(&MessageQueue->HardwareMessagesListHead, - &Current->ListEntry); - IntUnLockHardwareMessageQueue(MessageQueue); - } - IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current->Msg; - - if (Remove) - { - MsqDestroyMessage(Current); - } - - RETURN(TRUE); - } - /* If the contents of the queue changed then restart processing. */ - if (HardwareMessageQueueStamp != ActiveStamp) - { - CurrentEntry = HardwareMessageQueueHead.Flink; - continue; - } - } - } - - /* Check if the system message queue is now empty. */ - IntLockSystemMessageQueue(OldIrql); - if (SystemMessageQueueCount == 0 && IsListEmpty(&HardwareMessageQueueHead)) - { - KeClearEvent(&HardwareMessageEvent); - } - IntUnLockSystemMessageQueue(OldIrql); - IntUnLockSystemHardwareMessageQueueLock(FALSE); - - RETURN(FALSE); - -CLEANUP: - if (DesktopWindow) UserDerefObjectCo(DesktopWindow); - - END_CLEANUP; } // @@ -1323,6 +794,420 @@ MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode) MsqWakeQueue(MessageQueue, QS_POSTMESSAGE); } +/*********************************************************************** + * MsqSendParentNotify + * + * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless + * the window has the WS_EX_NOPARENTNOTIFY style. + */ +static void MsqSendParentNotify( PWND pwnd, WORD event, WORD idChild, POINT pt ) +{ + PWND pwndDesktop = UserGetWindowObject(IntGetDesktopWindow()); + + /* pt has to be in the client coordinates of the parent window */ + pt.x += pwndDesktop->rcClient.left - pwnd->rcClient.left; + pt.y += pwndDesktop->rcClient.top - pwnd->rcClient.top; + + for (;;) + { + PWND pwndParent; + + if (!(pwnd->style & WS_CHILD)) break; + if (pwnd->ExStyle & WS_EX_NOPARENTNOTIFY) break; + if (!(pwndParent = IntGetParent(pwnd))) break; + if (pwndParent == pwndDesktop) break; + pt.x += pwnd->rcClient.left - pwndParent->rcClient.left; + pt.y += pwnd->rcClient.top - pwndParent->rcClient.top; + + pwnd = pwndParent; + co_IntSendMessage( UserHMGetHandle(pwnd), WM_PARENTNOTIFY, + MAKEWPARAM( event, idChild ), MAKELPARAM( pt.x, pt.y ) ); + } +} + +BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT last) +{ + MSG clk_msg; + POINT pt; + UINT message; + USHORT hittest; + EVENTMSG event; + MOUSEHOOKSTRUCT hook; + BOOL eatMsg; + + PWND pwndMsg, pwndDesktop; + PUSER_MESSAGE_QUEUE MessageQueue; + PTHREADINFO pti; + PSYSTEM_CURSORINFO CurInfo; + DECLARE_RETURN(BOOL); + + pti = PsGetCurrentThreadWin32Thread(); + pwndDesktop = UserGetDesktopWindow(); + MessageQueue = pti->MessageQueue; + CurInfo = IntGetSysCursorInfo(); + pwndMsg = UserGetWindowObject(msg->hwnd); + clk_msg = MessageQueue->msgDblClk; + + /* find the window to dispatch this mouse message to */ + if (MessageQueue->CaptureWindow) + { + hittest = HTCLIENT; + pwndMsg = IntGetWindowObject(MessageQueue->CaptureWindow); + } + else + { + pwndMsg = co_WinPosWindowFromPoint(pwndMsg, &msg->pt, &hittest); + } + + DPRINT("Got mouse message for 0x%x, hittest: 0x%x\n", msg->hwnd, hittest ); + + if (pwndMsg == NULL || pwndMsg->head.pti != pti) + { + /* Remove and ignore the message */ + *RemoveMessages = TRUE; + RETURN(FALSE); + } + + msg->hwnd = UserHMGetHandle(pwndMsg); + + /* FIXME: is this really the right place for this hook? */ + event.message = msg->message; + event.time = msg->time; + event.hwnd = msg->hwnd; + event.paramL = msg->pt.x; + event.paramH = msg->pt.y; + co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event ); + +#if 0 + if (!check_hwnd_filter( msg, hwnd_filter )) RETURN(FALSE); +#endif + + pt = msg->pt; + message = msg->message; + /* Note: windows has no concept of a non-client wheel message */ + if (message != WM_MOUSEWHEEL) + { + if (hittest != HTCLIENT) + { + message += WM_NCMOUSEMOVE - WM_MOUSEMOVE; + msg->wParam = hittest; + } + else + { + /* coordinates don't get translated while tracking a menu */ + /* FIXME: should differentiate popups and top-level menus */ + if (!(MessageQueue->MenuOwner)) + { + pt.x += pwndDesktop->rcClient.left - pwndMsg->rcClient.left; + pt.y += pwndDesktop->rcClient.top - pwndMsg->rcClient.top; + } + } + } + msg->lParam = MAKELONG( pt.x, pt.y ); + + /* translate double clicks */ + + if ((msg->message == WM_LBUTTONDOWN) || + (msg->message == WM_RBUTTONDOWN) || + (msg->message == WM_MBUTTONDOWN) || + (msg->message == WM_XBUTTONDOWN)) + { + BOOL update = *RemoveMessages; + + /* translate double clicks - + * note that ...MOUSEMOVEs can slip in between + * ...BUTTONDOWN and ...BUTTONDBLCLK messages */ + + if ((MessageQueue->MenuOwner || MessageQueue->MoveSize) || + hittest != HTCLIENT || + (pwndMsg->pcls->style & CS_DBLCLKS)) + { + if ((msg->message == clk_msg.message) && + (msg->hwnd == clk_msg.hwnd) && + (msg->wParam == clk_msg.wParam) && + (msg->time - clk_msg.time < gspv.iDblClickTime) && + (abs(msg->pt.x - clk_msg.pt.x) < UserGetSystemMetrics(SM_CXDOUBLECLK)/2) && + (abs(msg->pt.y - clk_msg.pt.y) < UserGetSystemMetrics(SM_CYDOUBLECLK)/2)) + { + message += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); + if (update) + { + MessageQueue->msgDblClk.message = 0; /* clear the double click conditions */ + update = FALSE; + } + } + } + + if (!((first == 0 && last == 0) || (message >= first || message <= last))) + { + DPRINT("Message out of range!!!\n"); + RETURN(FALSE); + } + + /* update static double click conditions */ + if (update) MessageQueue->msgDblClk = *msg; + } + else + { + if (!((first == 0 && last == 0) || (message >= first || message <= last))) + { + DPRINT("Message out of range!!!\n"); + RETURN(FALSE); + } + } + + if(gspv.bMouseClickLock) + { + BOOL IsClkLck = FALSE; + + if(msg->message == WM_LBUTTONUP) + { + IsClkLck = ((msg->time - CurInfo->ClickLockTime) >= gspv.dwMouseClickLockTime); + if (IsClkLck && (!CurInfo->ClickLockActive)) + { + CurInfo->ClickLockActive = TRUE; + } + } + else if (msg->message == WM_LBUTTONDOWN) + { + if (CurInfo->ClickLockActive) + { + IsClkLck = TRUE; + CurInfo->ClickLockActive = FALSE; + } + + CurInfo->ClickLockTime = msg->time; + } + + if(IsClkLck) + { + /* Remove and ignore the message */ + *RemoveMessages = TRUE; + RETURN(FALSE); + } + } + + /* message is accepted now (but may still get dropped) */ + + hook.pt = msg->pt; + hook.hwnd = msg->hwnd; + hook.wHitTestCode = hittest; + hook.dwExtraInfo = 0/*extra_info*/; + if (co_HOOK_CallHooks( WH_MOUSE, *RemoveMessages ? HC_ACTION : HC_NOREMOVE, + message, (LPARAM)&hook )) + { + hook.pt = msg->pt; + hook.hwnd = msg->hwnd; + hook.wHitTestCode = hittest; + hook.dwExtraInfo = 0/*extra_info*/; + co_HOOK_CallHooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook ); + + DPRINT1("WH_MOUSE dorpped mouse message!\n"); + + /* Remove and skip message */ + *RemoveMessages = TRUE; + RETURN(FALSE); + } + + if ((hittest == HTERROR) || (hittest == HTNOWHERE)) + { + co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, + MAKELONG( hittest, msg->message )); + + /* Remove and skip message */ + *RemoveMessages = TRUE; + RETURN(FALSE); + } + + if ((*RemoveMessages == FALSE) || MessageQueue->CaptureWindow) + { + /* Accept the message */ + msg->message = message; + RETURN(TRUE); + } + + eatMsg = FALSE; + + if ((msg->message == WM_LBUTTONDOWN) || + (msg->message == WM_RBUTTONDOWN) || + (msg->message == WM_MBUTTONDOWN) || + (msg->message == WM_XBUTTONDOWN)) + { + /* Send the WM_PARENTNOTIFY, + * note that even for double/nonclient clicks + * notification message is still WM_L/M/RBUTTONDOWN. + */ + MsqSendParentNotify(pwndMsg, msg->message, 0, msg->pt ); + + /* Activate the window if needed */ + + if (msg->hwnd != MessageQueue->ActiveWindow) + { + PWND pwndTop = pwndMsg; + while (pwndTop) + { + if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break; + pwndTop = IntGetParent( pwndTop ); + } + + if (pwndTop && pwndTop != pwndDesktop) + { + LONG ret = co_IntSendMessage( msg->hwnd, + WM_MOUSEACTIVATE, + (WPARAM)UserHMGetHandle(pwndTop), + MAKELONG( hittest, msg->message)); + switch(ret) + { + case MA_NOACTIVATEANDEAT: + eatMsg = TRUE; + /* fall through */ + case MA_NOACTIVATE: + break; + case MA_ACTIVATEANDEAT: + eatMsg = TRUE; + /* fall through */ + case MA_ACTIVATE: + case 0: + if(!co_IntMouseActivateWindow(pwndMsg)) eatMsg = TRUE; + break; + default: + DPRINT1( "unknown WM_MOUSEACTIVATE code %d\n", ret ); + break; + } + } + } + } + + /* send the WM_SETCURSOR message */ + + /* Windows sends the normal mouse message as the message parameter + in the WM_SETCURSOR message even if it's non-client mouse message */ + co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG( hittest, msg->message )); + + msg->message = message; + RETURN(!eatMsg); + +CLEANUP: + if(pwndMsg) + UserDereferenceObject(pwndMsg); + + END_CLEANUP; +} + +BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) +{ + EVENTMSG Event; + + Event.message = Msg->message; + Event.hwnd = Msg->hwnd; + Event.time = Msg->time; + Event.paramL = (Msg->wParam & 0xFF) | (HIWORD(Msg->lParam) << 8); + Event.paramH = Msg->lParam & 0x7FFF; + if (HIWORD(Msg->lParam) & 0x0100) Event.paramH |= 0x8000; + co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&Event); + + if (co_HOOK_CallHooks( WH_KEYBOARD, + *RemoveMessages ? HC_ACTION : HC_NOREMOVE, + LOWORD(Msg->wParam), + Msg->lParam)) + { + /* skip this message */ + co_HOOK_CallHooks( WH_CBT, + HCBT_KEYSKIPPED, + LOWORD(Msg->wParam), + Msg->lParam ); + DPRINT1("KeyboardMessage WH_CBT Call Hook return!\n"); + return FALSE; + } + return TRUE; +} + +BOOL co_IntProcessHardwareMessage(MSG* Msg, BOOL* RemoveMessages, UINT first, UINT last) +{ + if ( IS_MOUSE_MESSAGE(Msg->message)) + { + return co_IntProcessMouseMessage(Msg, RemoveMessages, first, last); + } + else if ( IS_KBD_MESSAGE(Msg->message)) + { + return co_IntProcessKeyboardMessage(Msg, RemoveMessages); + } + + return TRUE; +} + +BOOL APIENTRY +co_MsqPeekMouseMove(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOL Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT MSG* pMsg) +{ + BOOL AcceptMessage; + MSG msg; + + if(!(MessageQueue->MouseMoved)) + return FALSE; + + msg = MessageQueue->MouseMoveMsg; + + AcceptMessage = co_IntProcessMouseMessage(&msg, &Remove, MsgFilterLow, MsgFilterHigh); + + if(AcceptMessage) + *pMsg = msg; + + if(Remove) + MessageQueue->MouseMoved = FALSE; + + return AcceptMessage; +} + +BOOL APIENTRY +co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, + IN BOOL Remove, + IN PWND Window, + IN UINT MsgFilterLow, + IN UINT MsgFilterHigh, + OUT MSG* pMsg) +{ + + BOOL AcceptMessage; + PUSER_MESSAGE CurrentMessage; + PLIST_ENTRY ListHead, CurrentEntry = NULL; + MSG msg; + + ListHead = &MessageQueue->HardwareMessagesListHead; + CurrentEntry = ListHead->Flink; + + while(CurrentEntry != ListHead) + { + CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, + ListEntry); + + msg = CurrentMessage->Msg; + + AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, MsgFilterLow, MsgFilterHigh); + + CurrentEntry = CurrentMessage->ListEntry.Flink; + + if (Remove) + { + RemoveEntryList(&CurrentMessage->ListEntry); + MsqDestroyMessage(CurrentMessage); + } + + if(AcceptMessage) + { + *pMsg = msg; + return TRUE; + } + + } + + return FALSE; +} + BOOLEAN APIENTRY MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue, IN BOOLEAN Remove, @@ -1368,19 +1253,14 @@ NTSTATUS FASTCALL co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax) { - PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent}; NTSTATUS ret; UserLeaveCo(); - - ret = KeWaitForMultipleObjects(2, - WaitObjects, - WaitAny, - Executive, - UserMode, - FALSE, - NULL, - NULL); + ret = KeWaitForSingleObject(MessageQueue->NewMessages, + Executive, + UserMode, + FALSE, + NULL); UserEnterCo(); return ret; } diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 7cab141bf0e..adc82e98bf1 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -4424,6 +4424,7 @@ NtUserWindowFromPoint(LONG X, LONG Y) POINT pt; HWND Ret; PWND DesktopWindow = NULL, Window = NULL; + USHORT hittest; DECLARE_RETURN(HWND); USER_REFERENCE_ENTRY Ref; @@ -4442,7 +4443,7 @@ NtUserWindowFromPoint(LONG X, LONG Y) UserRefObjectCo(DesktopWindow, &Ref); pti = PsGetCurrentThreadWin32Thread(); - co_WinPosWindowFromPoint(DesktopWindow, pti->MessageQueue, &pt, &Window); + Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest); if(Window) { diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 04c0fd7263f..b80c9db2e18 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -1578,162 +1578,99 @@ co_WinPosShowWindow(PWND Wnd, INT Cmd) return(WasVisible); } - -#if 0 - -/* find child of 'parent' that contains the given point (in parent-relative coords) */ -PWND child_window_from_point(PWND parent, int x, int y ) -{ - PWND Wnd;// = parent->spwndChild; - -// LIST_FOR_EACH_ENTRY( Wnd, &parent->children, struct window, entry ) - for (Wnd = parent->spwndChild; Wnd; Wnd = Wnd->spwndNext) - { - if (!IntPtInWindow( Wnd, x, y )) continue; /* skip it */ - - /* if window is minimized or disabled, return at once */ - if (Wnd->style & (WS_MINIMIZE|WS_DISABLED)) return Wnd; - - /* if point is not in client area, return at once */ - if (x < Wnd->rcClient.left || x >= Wnd->rcClient.right || - y < Wnd->rcClient.top || y >= Wnd->rcClient.bottom) - return Wnd; - - return child_window_from_point( Wnd, x - Wnd->rcClient.left, y - Wnd->rcClient.top ); - } - return parent; /* not found any child */ -} -#endif - -/* wine server: child_window_from_point - -Caller must dereference the "returned" Window -*/ static -VOID FASTCALL +PWND FASTCALL co_WinPosSearchChildren( PWND ScopeWin, - PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *Point, - PWND* Window, USHORT *HitTest ) { - PWND Current; - HWND *List, *phWnd; - USER_REFERENCE_ENTRY Ref; + PWND pwndChild; + HWND *List, *phWnd; - ASSERT_REFS_CO(ScopeWin); + if (!(ScopeWin->style & WS_VISIBLE)) + { + return NULL; + } - if ((List = IntWinListChildren(ScopeWin))) - { - for (phWnd = List; *phWnd; ++phWnd) - { - if (!(Current = UserGetWindowObject(*phWnd))) - continue; + if ((ScopeWin->style & WS_DISABLED)) + { + return NULL; + } - if (!(Current->style & WS_VISIBLE)) - { - continue; - } + if (!IntPtInWindow(ScopeWin, Point->x, Point->y)) + { + return NULL; + } - if ((Current->style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == - (WS_CHILD | WS_DISABLED)) - { - continue; - } + UserReferenceObject(ScopeWin); - if (!IntPtInWindow(Current, Point->x, Point->y)) - { - continue; - } - - if (*Window) UserDereferenceObject(*Window); - *Window = Current; - UserReferenceObject(*Window); - - if (Current->style & WS_MINIMIZE) - { - *HitTest = HTCAPTION; - break; - } - - if (Current->style & WS_DISABLED) - { - *HitTest = HTERROR; - break; - } - - UserRefObjectCo(Current, &Ref); - - if (OnlyHitTests && (Current->head.pti->MessageQueue == OnlyHitTests)) - { - *HitTest = co_IntSendMessage(Current->head.h, WM_NCHITTEST, 0, - MAKELONG(Point->x, Point->y)); - if ((*HitTest) == (USHORT)HTTRANSPARENT) + if (Point->x - ScopeWin->rcClient.left < ScopeWin->rcClient.right && + Point->y - ScopeWin->rcClient.top < ScopeWin->rcClient.bottom ) + { + List = IntWinListChildren(ScopeWin); + if(List) + { + for (phWnd = List; *phWnd; ++phWnd) { - UserDerefObjectCo(Current); - continue; + if (!(pwndChild = UserGetWindowObject(*phWnd))) + { + continue; + } + + pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest); + + if(pwndChild != NULL) + { + /* We found a window. Don't send any more WM_NCHITTEST messages */ + UserDereferenceObject(ScopeWin); + return pwndChild; + } } - } - else - *HitTest = HTCLIENT; + } - if (Point->x >= Current->rcClient.left && - Point->x < Current->rcClient.right && - Point->y >= Current->rcClient.top && - Point->y < Current->rcClient.bottom) - { - co_WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); - } + ExFreePool(List); + } - UserDerefObjectCo(Current); - - break; - } - ExFreePool(List); - } + *HitTest = co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0, + MAKELONG(Point->x, Point->y)); + if ((*HitTest) == (USHORT)HTTRANSPARENT) + { + UserDereferenceObject(ScopeWin); + return NULL; + } + + return ScopeWin; } -/* wine: WINPOS_WindowFromPoint */ -USHORT FASTCALL -co_WinPosWindowFromPoint(PWND ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint, - PWND* Window) +PWND FASTCALL +co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest) { - HWND DesktopWindowHandle; - PWND DesktopWindow; + PWND Window; POINT Point = *WinPoint; - USHORT HitTest; + USER_REFERENCE_ENTRY Ref; + + if( ScopeWin == NULL ) + { + ScopeWin = UserGetDesktopWindow(); + if(ScopeWin == NULL) + return NULL; + } + + *HitTest = HTNOWHERE; ASSERT_REFS_CO(ScopeWin); + UserRefObjectCo(ScopeWin, &Ref); - *Window = NULL; + Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest); - if(!ScopeWin) - { - DPRINT1("WinPosWindowFromPoint(): ScopeWin == NULL!\n"); - return(HTERROR); - } + UserDerefObjectCo(ScopeWin); + if(Window) + ASSERT_REFS_CO(Window); + ASSERT_REFS_CO(ScopeWin); - if (ScopeWin->style & WS_DISABLED) - { - return(HTERROR); - } - - /* Translate the point to the space of the scope window. */ - DesktopWindowHandle = IntGetDesktopWindow(); - if((DesktopWindowHandle != ScopeWin->head.h) && - (DesktopWindow = UserGetWindowObject(DesktopWindowHandle))) - { - Point.x += ScopeWin->rcClient.left - DesktopWindow->rcClient.left; - Point.y += ScopeWin->rcClient.top - DesktopWindow->rcClient.top; - } - - HitTest = HTNOWHERE; - - co_WinPosSearchChildren(ScopeWin, OnlyHitTests, &Point, Window, &HitTest); - - return ((*Window) ? HitTest : HTNOWHERE); + return Window; } BOOL From 4f335ab6b0310981440e0559e1709e4b5ac9f45a Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 22 Nov 2010 21:38:23 +0000 Subject: [PATCH 045/132] [NTOSKRNL] - Add missing PAGED_CODE() where needed - Removed a wrong ASSERT in FsRtlIsNameInExpressionPrivate() and replace it by the right one - Mark FsRtlIsDbcsInExpression() as halfplemented svn path=/trunk/; revision=49711 --- reactos/ntoskrnl/fsrtl/dbcsname.c | 11 +++++++++-- reactos/ntoskrnl/fsrtl/name.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/dbcsname.c b/reactos/ntoskrnl/fsrtl/dbcsname.c index 64359a50c01..da0fd71cb47 100644 --- a/reactos/ntoskrnl/fsrtl/dbcsname.c +++ b/reactos/ntoskrnl/fsrtl/dbcsname.c @@ -48,6 +48,7 @@ FsRtlDissectDbcs(IN ANSI_STRING Name, { ULONG FirstPosition, i; ULONG SkipFirstSlash = 0; + PAGED_CODE(); /* Zero the strings before continuing */ RtlZeroMemory(FirstPart, sizeof(ANSI_STRING)); @@ -116,6 +117,7 @@ NTAPI FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) { ULONG i; + PAGED_CODE(); /* Check every character */ for (i = 0; i < Name->Length; i++) @@ -138,7 +140,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) /*++ * @name FsRtlIsDbcsInExpression - * @implemented + * @halfplemented * * Check if the Name string is in the Expression string. * @@ -150,7 +152,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) * * @return TRUE if Name is found in Expression, FALSE otherwise * - * @remarks None + * @remarks Implementation should be fixed to handle wildcards * *--*/ BOOLEAN @@ -159,7 +161,10 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, IN PANSI_STRING Name) { ULONG ExpressionPosition, NamePosition, MatchingChars = 0; + PAGED_CODE(); + ASSERT(Name->Length); + ASSERT(Expression->Length); ASSERT(!FsRtlDoesDbcsContainWildCards(Name)); /* One can't be null, both can be */ @@ -242,6 +247,7 @@ FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName, ANSI_STRING FirstPart, RemainingPart, Name; BOOLEAN LastDot; ULONG i; + PAGED_CODE(); /* Just quit if the string is empty */ if (!DbcsName.Length) @@ -378,6 +384,7 @@ FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName, { ANSI_STRING FirstPart, RemainingPart, Name; ULONG i; + PAGED_CODE(); /* Just quit if the string is empty */ if (!DbcsName.Length) diff --git a/reactos/ntoskrnl/fsrtl/name.c b/reactos/ntoskrnl/fsrtl/name.c index 1405b9f99c4..291ecf7f12a 100644 --- a/reactos/ntoskrnl/fsrtl/name.c +++ b/reactos/ntoskrnl/fsrtl/name.c @@ -23,8 +23,9 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression, IN PWCHAR UpcaseTable OPTIONAL) { ULONG i = 0, j, k = 0; + PAGED_CODE(); - ASSERT(!FsRtlDoesNameContainWildCards(Name)); + ASSERT(!IgnoreCase || UpcaseTable); while (i < Name->Length / sizeof(WCHAR) && k < Expression->Length / sizeof(WCHAR)) { @@ -119,6 +120,7 @@ FsRtlAreNamesEqual(IN PCUNICODE_STRING Name1, BOOLEAN StringsAreEqual, MemoryAllocated = FALSE; ULONG i; NTSTATUS Status; + PAGED_CODE(); /* Well, first check their size */ if (Name1->Length != Name2->Length) return FALSE; @@ -210,6 +212,7 @@ FsRtlDissectName(IN UNICODE_STRING Name, { ULONG FirstPosition, i; ULONG SkipFirstSlash = 0; + PAGED_CODE(); /* Zero the strings before continuing */ RtlZeroMemory(FirstPart, sizeof(UNICODE_STRING)); @@ -272,6 +275,7 @@ NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name) { PWCHAR Ptr; + PAGED_CODE(); /* Loop through every character */ if (Name->Length) From e69e3b27ee82b013b5d603d445bb08a1fe9eee12 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 22 Nov 2010 22:18:02 +0000 Subject: [PATCH 046/132] [NTOSKRNL] - Renamed MmIsFileAPagingFile() to MmIsFileObjectAPagingFile() its appropriated name - Added it to internal headers - Implemented FsRtlIsPagingFile() svn path=/trunk/; revision=49712 --- reactos/ntoskrnl/fsrtl/filtrctx.c | 5 ++--- reactos/ntoskrnl/include/internal/mm.h | 4 ++++ reactos/ntoskrnl/mm/pagefile.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/filtrctx.c b/reactos/ntoskrnl/fsrtl/filtrctx.c index 24d88c45c4e..9d5bdf60c32 100644 --- a/reactos/ntoskrnl/fsrtl/filtrctx.c +++ b/reactos/ntoskrnl/fsrtl/filtrctx.c @@ -16,7 +16,7 @@ /*++ * @name FsRtlIsPagingFile - * @implemented NT 4.0 + * @implemented NT 5.2 * * The FsRtlIsPagingFile routine checks if the FileObject is a Paging File. * @@ -32,8 +32,7 @@ LOGICAL NTAPI FsRtlIsPagingFile(IN PFILE_OBJECT FileObject) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + return MmIsFileObjectAPagingFile(FileObject); } /* diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 7499571f550..3c194f5684d 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -778,6 +778,10 @@ VOID NTAPI MmInitPagingFile(VOID); +BOOLEAN +NTAPI +MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject); + NTSTATUS NTAPI MmReadFromSwapPage( diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index 2b3274aad67..cfa5d9cc6c5 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -132,7 +132,7 @@ MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages) BOOLEAN NTAPI -MmIsFileAPagingFile(PFILE_OBJECT FileObject) +MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject) { ULONG i; From d828ba929be31c49e3149a1f57c05591f796c9db Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 22 Nov 2010 23:08:11 +0000 Subject: [PATCH 047/132] [NPFS] Add an FCB that represents the file system (volume/device) and support absolute and relative open, cleanup and close. svn path=/trunk/; revision=49713 --- reactos/drivers/filesystems/npfs/create.c | 70 +++++++++++++++++++++++ reactos/drivers/filesystems/npfs/npfs.c | 10 +++- reactos/drivers/filesystems/npfs/npfs.h | 1 + 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/filesystems/npfs/create.c b/reactos/drivers/filesystems/npfs/create.c index dbcbaa1bd73..dc70991447e 100644 --- a/reactos/drivers/filesystems/npfs/create.c +++ b/reactos/drivers/filesystems/npfs/create.c @@ -105,6 +105,35 @@ NpfsSignalAndRemoveListeningServerInstance(PNPFS_FCB Fcb, } +static VOID +NpfsOpenFileSystem(PNPFS_FCB Fcb, + PFILE_OBJECT FileObject, + PIO_STATUS_BLOCK IoStatus) +{ + PNPFS_CCB Ccb; + + DPRINT("NpfsOpenFileSystem()\n"); + + Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); + if (Ccb == NULL) + { + IoStatus->Status = STATUS_NO_MEMORY; + return; + } + + Ccb->Type = CCB_DEVICE; + Ccb->Fcb = Fcb; + + FileObject->FsContext = Fcb; + FileObject->FsContext2 = Ccb; + + IoStatus->Information = FILE_OPENED; + IoStatus->Status = STATUS_SUCCESS; + + return; +} + + static VOID NpfsOpenRootDirectory(PNPFS_FCB Fcb, PFILE_OBJECT FileObject, @@ -174,6 +203,24 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, } #endif + DPRINT("FileName->Length: %hu RelatedFileObject: %p\n", FileName->Length, RelatedFileObject); + + /* Open the file system */ + if (FileName->Length == 0 && + (RelatedFileObject == NULL || ((PNPFS_CCB)RelatedFileObject->FsContext2)->Type == CCB_DEVICE)) + { + DPRINT("Open the file system\n"); + + NpfsOpenFileSystem(Vcb->DeviceFcb, + FileObject, + &Irp->IoStatus); + + Status = Irp->IoStatus.Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } + + /* Open the root directory */ if (FileName->Length == 2 && FileName->Buffer[0] == L'\\' && RelatedFileObject == NULL) { DPRINT("Open the root directory\n"); @@ -662,6 +709,15 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, return STATUS_SUCCESS; } + if (Ccb->Type == CCB_DEVICE) + { + DPRINT("Cleanup the file system!\n"); + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + if (Ccb->Type == CCB_DIRECTORY) { DPRINT("Cleanup the root directory!\n"); @@ -806,6 +862,20 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, return STATUS_SUCCESS; } + if (Ccb->Type == CCB_DEVICE) + { + DPRINT("Closing the file system!\n"); + + ExFreePool(Ccb); + FileObject->FsContext = NULL; + FileObject->FsContext2 = NULL; + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + if (Ccb->Type == CCB_DIRECTORY) { DPRINT("Closing the root directory!\n"); diff --git a/reactos/drivers/filesystems/npfs/npfs.c b/reactos/drivers/filesystems/npfs/npfs.c index 825abe3e21e..74fe99baeb6 100644 --- a/reactos/drivers/filesystems/npfs/npfs.c +++ b/reactos/drivers/filesystems/npfs/npfs.c @@ -85,12 +85,16 @@ DriverEntry(PDRIVER_OBJECT DriverObject, Vcb->DefaultQuota = 8 * PAGE_SIZE; Vcb->MaxQuota = 64 * PAGE_SIZE; + /* Create the device FCB */ + Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); + Fcb->Type = FCB_DEVICE; + Fcb->Vcb = Vcb; + Vcb->DeviceFcb = Fcb; + + /* Create the root directory FCB */ Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); Fcb->Type = FCB_DIRECTORY; Fcb->Vcb = Vcb; - - - Vcb->RootFcb = Fcb; return STATUS_SUCCESS; diff --git a/reactos/drivers/filesystems/npfs/npfs.h b/reactos/drivers/filesystems/npfs/npfs.h index cb37cb0564d..2e47e6858c4 100644 --- a/reactos/drivers/filesystems/npfs/npfs.h +++ b/reactos/drivers/filesystems/npfs/npfs.h @@ -28,6 +28,7 @@ typedef struct _NPFS_VCB ULONG MinQuota; ULONG DefaultQuota; ULONG MaxQuota; + struct _NPFS_FCB *DeviceFcb; struct _NPFS_FCB *RootFcb; } NPFS_VCB, *PNPFS_VCB; From 332a782a372de0be6bdb8530e5dc198aa8afc0e4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 22 Nov 2010 23:18:59 +0000 Subject: [PATCH 048/132] [GDI32] Don't make the wrong assumption that POINT and POINTL are identical. svn path=/trunk/; revision=49714 --- reactos/dll/win32/gdi32/objects/coord.c | 2 +- reactos/dll/win32/gdi32/objects/dc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/coord.c b/reactos/dll/win32/gdi32/objects/coord.c index 93381e79ece..866108530b9 100644 --- a/reactos/dll/win32/gdi32/objects/coord.c +++ b/reactos/dll/win32/gdi32/objects/coord.c @@ -255,7 +255,7 @@ GetViewportExtEx( if ((Dc_Attr->flXform & PAGE_EXTENTS_CHANGED) && (Dc_Attr->iMapMode == MM_ISOTROPIC)) // Something was updated, go to kernel. - return NtGdiGetDCPoint( hdc, GdiGetViewPortExt, (LPPOINT) lpSize ); + return NtGdiGetDCPoint( hdc, GdiGetViewPortExt, (PPOINTL) lpSize ); else { lpSize->cx = Dc_Attr->szlViewportExt.cx; diff --git a/reactos/dll/win32/gdi32/objects/dc.c b/reactos/dll/win32/gdi32/objects/dc.c index eb9dcf2ff30..7693dcc9592 100644 --- a/reactos/dll/win32/gdi32/objects/dc.c +++ b/reactos/dll/win32/gdi32/objects/dc.c @@ -746,7 +746,7 @@ GetAspectRatioFilterEx( LPSIZE lpAspectRatio ) { - return NtGdiGetDCPoint( hdc, GdiGetAspectRatioFilter, (LPPOINT) lpAspectRatio ); + return NtGdiGetDCPoint( hdc, GdiGetAspectRatioFilter, (PPOINTL) lpAspectRatio ); } @@ -760,7 +760,7 @@ GetDCOrgEx( LPPOINT lpPoint ) { - return NtGdiGetDCPoint( hdc, GdiGetDCOrg, lpPoint ); + return NtGdiGetDCPoint( hdc, GdiGetDCOrg, (PPOINTL)lpPoint ); } From e08f002f4096c8b3c5d07158b6c752d0802af198 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 22 Nov 2010 23:20:50 +0000 Subject: [PATCH 049/132] [WIN32K] Apply workaround for POINT / POINTL, like for the others svn path=/trunk/; revision=49715 --- reactos/subsystems/win32/win32k/pch.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/subsystems/win32/win32k/pch.h b/reactos/subsystems/win32/win32k/pch.h index 90075c80058..339918377a1 100644 --- a/reactos/subsystems/win32/win32k/pch.h +++ b/reactos/subsystems/win32/win32k/pch.h @@ -33,6 +33,9 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #define PRECT PRECTL #define LPRECT LPRECTL #define LPCRECT LPCRECTL +#define POINT POINTL +#define LPPOINT PPOINTL +#define PPOINT PPOINTL #include #include From c06fd57e9cc64253d6946b7a8d41af19328e78e6 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 22 Nov 2010 23:30:01 +0000 Subject: [PATCH 050/132] [NTOSKRNL] - Implemented FsRtlLookupPerStreamContextInternal(), FsRtlInsertPerStreamContext(), FsRtlRemovePerStreamContext(), FsRtlTeardownPerStreamContexts() Based on my previous work on pierre-fsd branch. svn path=/trunk/; revision=49716 --- reactos/ntoskrnl/fsrtl/filtrctx.c | 157 ++++++++++++++++++++++++++---- 1 file changed, 139 insertions(+), 18 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/filtrctx.c b/reactos/ntoskrnl/fsrtl/filtrctx.c index 9d5bdf60c32..458d907468d 100644 --- a/reactos/ntoskrnl/fsrtl/filtrctx.c +++ b/reactos/ntoskrnl/fsrtl/filtrctx.c @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fsrtl/filtrctx.c * PURPOSE: File Stream Filter Context support for File System Drivers - * PROGRAMMERS: None. + * PROGRAMMERS: Pierre Schweitzer (pierre.schweitzer@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -36,16 +36,51 @@ FsRtlIsPagingFile(IN PFILE_OBJECT FileObject) } /* - * @unimplemented + * @implemented */ PFSRTL_PER_STREAM_CONTEXT NTAPI -FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, +FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, IN PVOID OwnerId OPTIONAL, IN PVOID InstanceId OPTIONAL) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + PLIST_ENTRY NextEntry; + PFSRTL_PER_STREAM_CONTEXT TmpPerStreamContext, PerStreamContext = NULL; + + ASSERT(AdvFcbHeader); + ASSERT(FlagOn(AdvFcbHeader->Flags2, FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS)); + + ExAcquireFastMutex(AdvFcbHeader->FastMutex); + + /* If list is empty, no need to browse it */ + if (!IsListEmpty(&(AdvFcbHeader->FilterContexts))) + { + for (NextEntry = AdvFcbHeader->FilterContexts.Flink; + NextEntry != &(AdvFcbHeader->FilterContexts); + NextEntry = NextEntry->Flink) + { + /* If we don't have any criteria for search, first entry will be enough */ + if (!OwnerId && !InstanceId) + { + PerStreamContext = (PFSRTL_PER_STREAM_CONTEXT)NextEntry; + break; + } + /* Else, we've to find something that matches with the parameters. */ + else + { + TmpPerStreamContext = CONTAINING_RECORD(NextEntry, FSRTL_PER_STREAM_CONTEXT, Links); + if ((InstanceId && TmpPerStreamContext->InstanceId == InstanceId && TmpPerStreamContext->OwnerId == OwnerId) || + (OwnerId && TmpPerStreamContext->OwnerId == OwnerId)) + { + PerStreamContext = TmpPerStreamContext; + break; + } + } + } + } + ExReleaseFastMutex(AdvFcbHeader->FastMutex); + + return PerStreamContext; } /* @@ -62,28 +97,77 @@ FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject, } /* - * @unimplemented + * @implemented */ NTSTATUS NTAPI -FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER PerStreamContext, - IN PFSRTL_PER_STREAM_CONTEXT Ptr) +FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, + IN PFSRTL_PER_STREAM_CONTEXT PerStreamContext) { - KeBugCheck(FILE_SYSTEM); - return STATUS_NOT_IMPLEMENTED; + if (!(AdvFcbHeader) || !(AdvFcbHeader->Flags2 & FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS)) + { + return STATUS_INVALID_DEVICE_REQUEST; + } + + ExAcquireFastMutex(AdvFcbHeader->FastMutex); + InsertHeadList(&(AdvFcbHeader->FilterContexts), &(PerStreamContext->Links)); + ExReleaseFastMutex(AdvFcbHeader->FastMutex); + return STATUS_SUCCESS; } /* - * @unimplemented + * @implemented */ PFSRTL_PER_STREAM_CONTEXT NTAPI -FsRtlRemovePerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, +FsRtlRemovePerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, IN PVOID OwnerId OPTIONAL, IN PVOID InstanceId OPTIONAL) { - KeBugCheck(FILE_SYSTEM); - return NULL; + PLIST_ENTRY NextEntry; + PFSRTL_PER_STREAM_CONTEXT TmpPerStreamContext, PerStreamContext = NULL; + + if (!(AdvFcbHeader) || !(AdvFcbHeader->Flags2 & FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS)) + { + return NULL; + } + + ExAcquireFastMutex(AdvFcbHeader->FastMutex); + /* If list is empty, no need to browse it */ + if (!IsListEmpty(&(AdvFcbHeader->FilterContexts))) + { + for (NextEntry = AdvFcbHeader->FilterContexts.Flink; + NextEntry != &(AdvFcbHeader->FilterContexts); + NextEntry = NextEntry->Flink) + { + /* If we don't have any criteria for search, first entry will be enough */ + if (!OwnerId && !InstanceId) + { + PerStreamContext = (PFSRTL_PER_STREAM_CONTEXT)NextEntry; + break; + } + /* Else, we've to find something that matches with the parameters. */ + else + { + TmpPerStreamContext = CONTAINING_RECORD(NextEntry, FSRTL_PER_STREAM_CONTEXT, Links); + if ((InstanceId && TmpPerStreamContext->InstanceId == InstanceId && TmpPerStreamContext->OwnerId == OwnerId) || + (OwnerId && TmpPerStreamContext->OwnerId == OwnerId)) + { + PerStreamContext = TmpPerStreamContext; + break; + } + } + } + /* Finally remove entry from list */ + if (PerStreamContext) + { + RemoveEntryList(&(PerStreamContext->Links)); + } + } + ExReleaseFastMutex(AdvFcbHeader->FastMutex); + + return PerStreamContext; + } /* @@ -112,12 +196,49 @@ FsRtlRemovePerFileObjectContext(IN PFILE_OBJECT PerFileObjectContext, } /* - * @unimplemented + * @implemented */ VOID NTAPI -FsRtlTeardownPerStreamContexts(IN PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader) +FsRtlTeardownPerStreamContexts(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader) { - KeBugCheck(FILE_SYSTEM); -} + PLIST_ENTRY NextEntry; + BOOLEAN IsMutexLocked = FALSE; + PFSRTL_PER_STREAM_CONTEXT PerStreamContext; + _SEH2_TRY + { + /* Acquire mutex to deal with the list */ + ExAcquireFastMutex(AdvFcbHeader->FastMutex); + IsMutexLocked = TRUE; + + /* While there are items... */ + while (!IsListEmpty(&(AdvFcbHeader->FilterContexts))) + { + /* ...remove one */ + NextEntry = RemoveHeadList(&(AdvFcbHeader->FilterContexts)); + PerStreamContext = CONTAINING_RECORD(NextEntry, FSRTL_PER_STREAM_CONTEXT, Links); + + /* Release mutex before calling callback */ + ExReleaseFastMutex(AdvFcbHeader->FastMutex); + IsMutexLocked = FALSE; + + /* Call the callback */ + ASSERT(PerStreamContext->FreeCallback); + (*PerStreamContext->FreeCallback)(PerStreamContext); + + /* Relock the list to continue */ + ExAcquireFastMutex(AdvFcbHeader->FastMutex); + IsMutexLocked = TRUE; + } + } + _SEH2_FINALLY + { + /* If mutex was locked, release */ + if (IsMutexLocked) + { + ExReleaseFastMutex(AdvFcbHeader->FastMutex); + } + } + _SEH2_END; +} From 4aa271271e2a23c1c76542ea9aaa129dbc44d84c Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 22 Nov 2010 23:51:00 +0000 Subject: [PATCH 051/132] [NTOSKRNL] Add missing prototype and define svn path=/trunk/; revision=49717 --- reactos/ntoskrnl/fsrtl/filtrctx.c | 74 ++++++++++++++++++------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/filtrctx.c b/reactos/ntoskrnl/fsrtl/filtrctx.c index 458d907468d..15bff1c2637 100644 --- a/reactos/ntoskrnl/fsrtl/filtrctx.c +++ b/reactos/ntoskrnl/fsrtl/filtrctx.c @@ -12,6 +12,20 @@ #define NDEBUG #include +/* PRIVATE FUNCTIONS *********************************************************/ + +typedef struct _FILE_OBJECT_FILTER_CONTEXTS +{ + FAST_MUTEX FilterContextsMutex; + LIST_ENTRY FilterContexts; +} FILE_OBJECT_FILTER_CONTEXTS, *PFILE_OBJECT_FILTER_CONTEXTS; + +VOID +FsRtlPTeardownPerFileObjectContexts(IN PFILE_OBJECT FileObject) +{ +} + + /* PUBLIC FUNCTIONS **********************************************************/ /*++ @@ -35,6 +49,19 @@ FsRtlIsPagingFile(IN PFILE_OBJECT FileObject) return MmIsFileObjectAPagingFile(FileObject); } +/* + * @unimplemented + */ +PFSRTL_PER_FILEOBJECT_CONTEXT +NTAPI +FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject, + IN PVOID OwnerId OPTIONAL, + IN PVOID InstanceId OPTIONAL) +{ + KeBugCheck(FILE_SYSTEM); + return FALSE; +} + /* * @implemented */ @@ -86,14 +113,13 @@ FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, /* * @unimplemented */ -PFSRTL_PER_FILEOBJECT_CONTEXT +NTSTATUS NTAPI -FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject, - IN PVOID OwnerId OPTIONAL, - IN PVOID InstanceId OPTIONAL) +FsRtlInsertPerFileObjectContext(IN PFILE_OBJECT FileObject, + IN PFSRTL_PER_FILEOBJECT_CONTEXT Ptr) { KeBugCheck(FILE_SYSTEM); - return FALSE; + return STATUS_NOT_IMPLEMENTED; } /* @@ -115,6 +141,19 @@ FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, return STATUS_SUCCESS; } +/* + * @unimplemented + */ +PFSRTL_PER_FILEOBJECT_CONTEXT +NTAPI +FsRtlRemovePerFileObjectContext(IN PFILE_OBJECT PerFileObjectContext, + IN PVOID OwnerId OPTIONAL, + IN PVOID InstanceId OPTIONAL) +{ + KeBugCheck(FILE_SYSTEM); + return NULL; +} + /* * @implemented */ @@ -170,31 +209,6 @@ FsRtlRemovePerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER AdvFcbHeader, } -/* - * @unimplemented - */ -NTSTATUS -NTAPI -FsRtlInsertPerFileObjectContext(IN PFILE_OBJECT FileObject, - IN PFSRTL_PER_FILEOBJECT_CONTEXT Ptr) -{ - KeBugCheck(FILE_SYSTEM); - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -PFSRTL_PER_FILEOBJECT_CONTEXT -NTAPI -FsRtlRemovePerFileObjectContext(IN PFILE_OBJECT PerFileObjectContext, - IN PVOID OwnerId OPTIONAL, - IN PVOID InstanceId OPTIONAL) -{ - KeBugCheck(FILE_SYSTEM); - return NULL; -} - /* * @implemented */ From b9ced2b73b678ce0fa9ece8ff7d7aeb1d94da8f9 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Nov 2010 00:06:01 +0000 Subject: [PATCH 052/132] [PSDK] Partly sync windef.h with mingw-w64 and add specstrings.h svn path=/trunk/; revision=49718 --- reactos/include/psdk/specstrings.h | 273 +++++++++++ reactos/include/psdk/windef.h | 731 +++++++++++++++-------------- reactos/include/psdk/winnt.h | 56 +++ 3 files changed, 720 insertions(+), 340 deletions(-) create mode 100644 reactos/include/psdk/specstrings.h diff --git a/reactos/include/psdk/specstrings.h b/reactos/include/psdk/specstrings.h new file mode 100644 index 00000000000..568bb983e04 --- /dev/null +++ b/reactos/include/psdk/specstrings.h @@ -0,0 +1,273 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#define __specstrings + +#ifdef __cplusplus +#ifndef __nothrow +#define __nothrow __declspec(nothrow) +#endif +#else +#ifndef __nothrow +#define __nothrow +#endif +#endif + +#define __deref_in +#define __deref_in_ecount(size) +#define __deref_in_bcount(size) +#define __deref_in_opt +#define __deref_in_ecount_opt(size) +#define __deref_in_bcount_opt(size) +#define __deref_opt_in +#define __deref_opt_in_ecount(size) +#define __deref_opt_in_bcount(size) +#define __deref_opt_in_opt +#define __deref_opt_in_ecount_opt(size) +#define __deref_opt_in_bcount_opt(size) +#define __out_awcount(expr,size) +#define __in_awcount(expr,size) +#define __null +#define __notnull +#define __maybenull +#define __readonly +#define __notreadonly +#define __maybereadonly +#define __valid +#define __notvalid +#define __maybevalid +#define __readableTo(extent) +#define __elem_readableTo(size) +#define __byte_readableTo(size) +#define __writableTo(size) +#define __elem_writableTo(size) +#define __byte_writableTo(size) +#define __deref +#define __pre +#define __post +#define __precond(expr) +#define __postcond(expr) +#define __exceptthat +#define __execeptthat +#define __inner_success(expr) +#define __inner_checkReturn +#define __inner_typefix(ctype) +#define __inner_override +#define __inner_callback +#define __inner_blocksOn(resource) +#define __inner_fallthrough_dec +#define __inner_fallthrough +#define __refparam +#define __inner_control_entrypoint(category) +#define __inner_data_entrypoint(category) +#define __ecount(size) +#define __bcount(size) +#define __in +#define __in_opt +#define __in_nz +#define __in_nz_opt +#define __in_z +#define __in_z_opt +#define __in_ecount(size) +#define __in_ecount_nz(size) +#define __in_ecount_z(size) +#define __in_bcount(size) +#define __in_bcount_z(size) +#define __in_bcount_nz(size) +#define __in_ecount_opt(size) +#define __in_bcount_opt(size) +#define __in_ecount_z_opt(size) +#define __in_bcount_z_opt(size) +#define __in_ecount_nz_opt(size) +#define __in_bcount_nz_opt(size) +#define __out +#define __out_ecount(size) +#define __out_z +#define __out_nz +#define __out_nz_opt +#define __out_z_opt +#define __out_ecount_part(size,length) +#define __out_ecount_full(size) +#define __out_ecount_nz(size) +#define __out_ecount_z(size) +#define __out_ecount_part_z(size,length) +#define __out_ecount_full_z(size) +#define __out_bcount(size) +#define __out_bcount_part(size,length) +#define __out_bcount_full(size) +#define __out_bcount_z(size) +#define __out_bcount_part_z(size,length) +#define __out_bcount_full_z(size) +#define __out_bcount_nz(size) +#define __inout +#define __inout_ecount(size) +#define __inout_bcount(size) +#define __inout_ecount_part(size,length) +#define __inout_bcount_part(size,length) +#define __inout_ecount_full(size) +#define __inout_bcount_full(size) +#define __inout_z +#define __inout_ecount_z(size) +#define __inout_bcount_z(size) +#define __inout_nz +#define __inout_ecount_nz(size) +#define __inout_bcount_nz(size) +#define __ecount_opt(size) +#define __bcount_opt(size) +#define __out_opt +#define __out_ecount_opt(size) +#define __out_bcount_opt(size) +#define __out_ecount_part_opt(size,length) +#define __out_bcount_part_opt(size,length) +#define __out_ecount_full_opt(size) +#define __out_bcount_full_opt(size) +#define __out_ecount_z_opt(size) +#define __out_bcount_z_opt(size) +#define __out_ecount_part_z_opt(size,length) +#define __out_bcount_part_z_opt(size,length) +#define __out_ecount_full_z_opt(size) +#define __out_bcount_full_z_opt(size) +#define __out_ecount_nz_opt(size) +#define __out_bcount_nz_opt(size) +#define __inout_opt +#define __inout_ecount_opt(size) +#define __inout_bcount_opt(size) +#define __inout_ecount_part_opt(size,length) +#define __inout_bcount_part_opt(size,length) +#define __inout_ecount_full_opt(size) +#define __inout_bcount_full_opt(size) +#define __inout_z_opt +#define __inout_ecount_z_opt(size) +#define __inout_bcount_z_opt(size) +#define __inout_nz_opt +#define __inout_ecount_nz_opt(size) +#define __inout_bcount_nz_opt(size) +#define __deref_ecount(size) +#define __deref_bcount(size) +#define __deref_out +#define __deref_out_ecount(size) +#define __deref_out_bcount(size) +#define __deref_out_ecount_part(size,length) +#define __deref_out_bcount_part(size,length) +#define __deref_out_ecount_full(size) +#define __deref_out_bcount_full(size) +#define __deref_out_z +#define __deref_out_ecount_z(size) +#define __deref_out_bcount_z(size) +#define __deref_out_nz +#define __deref_out_ecount_nz(size) +#define __deref_out_bcount_nz(size) +#define __deref_inout +#define __deref_inout_ecount(size) +#define __deref_inout_bcount(size) +#define __deref_inout_ecount_part(size,length) +#define __deref_inout_bcount_part(size,length) +#define __deref_inout_ecount_full(size) +#define __deref_inout_bcount_full(size) +#define __deref_inout_z +#define __deref_inout_ecount_z(size) +#define __deref_inout_bcount_z(size) +#define __deref_inout_nz +#define __deref_inout_ecount_nz(size) +#define __deref_inout_bcount_nz(size) +#define __deref_ecount_opt(size) +#define __deref_bcount_opt(size) +#define __deref_out_opt +#define __deref_out_ecount_opt(size) +#define __deref_out_bcount_opt(size) +#define __deref_out_ecount_part_opt(size,length) +#define __deref_out_bcount_part_opt(size,length) +#define __deref_out_ecount_full_opt(size) +#define __deref_out_bcount_full_opt(size) +#define __deref_out_z_opt +#define __deref_out_ecount_z_opt(size) +#define __deref_out_bcount_z_opt(size) +#define __deref_out_nz_opt +#define __deref_out_ecount_nz_opt(size) +#define __deref_out_bcount_nz_opt(size) +#define __deref_inout_opt +#define __deref_inout_ecount_opt(size) +#define __deref_inout_bcount_opt(size) +#define __deref_inout_ecount_part_opt(size,length) +#define __deref_inout_bcount_part_opt(size,length) +#define __deref_inout_ecount_full_opt(size) +#define __deref_inout_bcount_full_opt(size) +#define __deref_inout_z_opt +#define __deref_inout_ecount_z_opt(size) +#define __deref_inout_bcount_z_opt(size) +#define __deref_inout_nz_opt +#define __deref_inout_ecount_nz_opt(size) +#define __deref_inout_bcount_nz_opt(size) +#define __deref_opt_ecount(size) +#define __deref_opt_bcount(size) +#define __deref_opt_out +#define __deref_opt_out_z +#define __deref_opt_out_ecount(size) +#define __deref_opt_out_bcount(size) +#define __deref_opt_out_ecount_part(size,length) +#define __deref_opt_out_bcount_part(size,length) +#define __deref_opt_out_ecount_full(size) +#define __deref_opt_out_bcount_full(size) +#define __deref_opt_inout +#define __deref_opt_inout_ecount(size) +#define __deref_opt_inout_bcount(size) +#define __deref_opt_inout_ecount_part(size,length) +#define __deref_opt_inout_bcount_part(size,length) +#define __deref_opt_inout_ecount_full(size) +#define __deref_opt_inout_bcount_full(size) +#define __deref_opt_inout_z +#define __deref_opt_inout_ecount_z(size) +#define __deref_opt_inout_bcount_z(size) +#define __deref_opt_inout_nz +#define __deref_opt_inout_ecount_nz(size) +#define __deref_opt_inout_bcount_nz(size) +#define __deref_opt_ecount_opt(size) +#define __deref_opt_bcount_opt(size) +#define __deref_opt_out_opt +#define __deref_opt_out_ecount_opt(size) +#define __deref_opt_out_bcount_opt(size) +#define __deref_opt_out_ecount_part_opt(size,length) +#define __deref_opt_out_bcount_part_opt(size,length) +#define __deref_opt_out_ecount_full_opt(size) +#define __deref_opt_out_bcount_full_opt(size) +#define __deref_opt_out_z_opt +#define __deref_opt_out_ecount_z_opt(size) +#define __deref_opt_out_bcount_z_opt(size) +#define __deref_opt_out_nz_opt +#define __deref_opt_out_ecount_nz_opt(size) +#define __deref_opt_out_bcount_nz_opt(size) +#define __deref_opt_inout_opt +#define __deref_opt_inout_ecount_opt(size) +#define __deref_opt_inout_bcount_opt(size) +#define __deref_opt_inout_ecount_part_opt(size,length) +#define __deref_opt_inout_bcount_part_opt(size,length) +#define __deref_opt_inout_ecount_full_opt(size) +#define __deref_opt_inout_bcount_full_opt(size) +#define __deref_opt_inout_z_opt +#define __deref_opt_inout_ecount_z_opt(size) +#define __deref_opt_inout_bcount_z_opt(size) +#define __deref_opt_inout_nz_opt +#define __deref_opt_inout_ecount_nz_opt(size) +#define __deref_opt_inout_bcount_nz_opt(size) +#define __success(expr) +#define __nullterminated +#define __nullnullterminated +#define __reserved +#define __checkReturn +#define __typefix(ctype) +#define __override +#define __callback +#define __format_string +#define __blocksOn(resource) +#define __control_entrypoint(category) +#define __data_entrypoint(category) +#ifndef __fallthrough +#define __fallthrough +#endif +#ifndef __analysis_assume +#define __analysis_assume(expr) +#endif + + diff --git a/reactos/include/psdk/windef.h b/reactos/include/psdk/windef.h index a29a959e747..2412dc75705 100644 --- a/reactos/include/psdk/windef.h +++ b/reactos/include/psdk/windef.h @@ -1,5 +1,17 @@ -#ifndef _WINDEF_H -#define _WINDEF_H +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#ifndef _WINDEF_ +#define _WINDEF_ + +#define _WINDEF_H // wine ... + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4255) +#endif #ifndef _M_AMD64 #if !defined(__ROS_LONG64__) @@ -9,62 +21,68 @@ #endif #endif +#ifndef NO_STRICT +#ifndef STRICT +#define STRICT 1 +#endif +#endif + +#ifndef WIN32 +#define WIN32 +#endif + +#if defined(_MAC) && !defined(_WIN32) +#define _WIN32 +#endif + #ifdef __cplusplus extern "C" { #endif -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4255) +#ifndef WINVER +#define WINVER 0x0502 #endif -#ifndef WINVER -#define WINVER 0x0400 -/* - * If you need Win32 API features newer the Win95 and WinNT then you must - * define WINVER before including windows.h or any other method of including - * the windef.h header. - */ -#endif -#ifndef _WIN32_WINNT -#define _WIN32_WINNT WINVER -/* - * There may be the need to define _WIN32_WINNT to a value different from - * the value of WINVER. I don't have any example of why you would do that. - * However, if you must then define _WIN32_WINNT to the value required before - * including windows.h or any other method of including the windef.h header. - */ -#endif -#ifndef WIN32 -#define WIN32 -#endif -#ifndef _WIN32 -#define _WIN32 -#endif -#define FAR -#define far -#define NEAR -#define near -#ifndef CONST -#define CONST const +#ifndef BASETYPES +#define BASETYPES +#ifndef __ROS_LONG64__ +typedef unsigned long ULONG; +#else +typedef unsigned int ULONG; #endif +typedef ULONG *PULONG; +typedef unsigned short USHORT; +typedef USHORT *PUSHORT; +typedef unsigned char UCHAR; +typedef UCHAR *PUCHAR; +typedef char *PSZ; +typedef int INT; +#endif /* BASETYPES */ + #undef MAX_PATH #define MAX_PATH 260 #ifndef NULL #ifdef __cplusplus +#ifndef _WIN64 #define NULL 0 #else -#define NULL ((void*)0) +#define NULL 0LL +#endif /* W64 */ +#else +#define NULL ((void *)0) #endif #endif + #ifndef FALSE #define FALSE 0 #endif + #ifndef TRUE #define TRUE 1 #endif +#ifndef _NO_W32_PSEUDO_MODIFIERS #ifndef IN #define IN #endif @@ -74,6 +92,307 @@ extern "C" { #ifndef OPTIONAL #define OPTIONAL #endif +#endif + +#ifdef __GNUC__ +#define PACKED __attribute__((packed)) +#ifndef __declspec +#define __declspec(e) __attribute__((e)) +#endif +#ifndef _declspec +#define _declspec(e) __attribute__((e)) +#endif +#elif defined(__WATCOMC__) +#define PACKED +#else +#define PACKED +#define _cdecl +#define __cdecl +#endif + +#ifdef __GNUC__ +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) __stdcall type +#elif defined(__WATCOMC__) +#define DECLSPEC_NORETURN +#define DECLARE_STDCALL_P( type ) type __stdcall +#elif defined(_MSC_VER) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) type __stdcall +#endif /* __GNUC__/__WATCOMC__ */ + +#define DECLSPEC_IMPORT __declspec(dllimport) +#define DECLSPEC_EXPORT __declspec(dllexport) +#ifndef DECLSPEC_NOINLINE +#if (_MSC_VER >= 1300) +#define DECLSPEC_NOINLINE __declspec(noinline) +#elif defined(__GNUC__) +#define DECLSPEC_NOINLINE __attribute__((noinline)) +#else +#define DECLSPEC_NOINLINE +#endif +#endif + +#undef far +#undef near +#undef pascal + +#define far +#define near +#define pascal __stdcall + +//#define cdecl _cdecl +#ifndef CDECL +#define CDECL _cdecl +#endif + +#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) +#ifndef CALLBACK +#define CALLBACK __stdcall +#endif +#ifndef WINAPI +#define WINAPI __stdcall +#endif +#define WINAPIV __cdecl +#define APIENTRY WINAPI +#define APIPRIVATE WINAPI +#define PASCAL WINAPI +#else +#define CALLBACK +#define WINAPI +#define WINAPIV +#define APIENTRY WINAPI +#define APIPRIVATE +#define PASCAL pascal +#endif + +#undef FAR +#undef NEAR +#define FAR +#define NEAR + +#ifndef CONST +#define CONST const +#endif + +#ifndef _DEF_WINBOOL_ +#define _DEF_WINBOOL_ +typedef int WINBOOL; +#pragma push_macro("BOOL") +#undef BOOL +#if !defined(__OBJC__) && !defined(__OBJC_BOOL) && !defined(__objc_INCLUDE_GNU) +typedef int BOOL; +#endif +#define BOOL WINBOOL +typedef BOOL *PBOOL; +typedef BOOL *LPBOOL; +#pragma pop_macro("BOOL") +#endif /* _DEF_WINBOOL_ */ + +typedef unsigned char BYTE; +typedef unsigned short WORD; +#ifndef __ROS_LONG64__ + typedef unsigned long DWORD; +#else + typedef unsigned int DWORD; +#endif +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BYTE *PBYTE; +typedef BYTE *LPBYTE; +typedef int *PINT; +typedef int *LPINT; +typedef WORD *PWORD; +typedef WORD *LPWORD; +#ifndef __ROS_LONG64__ +typedef long *LPLONG; +#else +typedef int *LPLONG; +#endif +typedef DWORD *PDWORD; +typedef DWORD *LPDWORD; +typedef void *LPVOID; +#ifndef _LPCVOID_DEFINED +#define _LPCVOID_DEFINED +typedef CONST void *LPCVOID; +#endif +//typedef int INT; +typedef unsigned int UINT; +typedef unsigned int *PUINT; +typedef unsigned int *LPUINT; + + + + +#ifndef NT_INCLUDED +#include +#endif + +#include + +typedef UINT_PTR WPARAM; +typedef LONG_PTR LPARAM; +typedef LONG_PTR LRESULT; +#ifndef _HRESULT_DEFINED +typedef LONG HRESULT; +#define _HRESULT_DEFINED +#endif + +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif + +#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) +#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) +#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) +#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) +#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) +#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) + +#ifndef WIN_INTERNAL +DECLARE_HANDLE (HWND); +//DECLARE_HANDLE (HHOOK); +#ifdef WINABLE +DECLARE_HANDLE (HEVENT); +#endif +#endif + +typedef WORD ATOM; + +typedef HANDLE *SPHANDLE; +typedef HANDLE *LPHANDLE; +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; +#ifdef _WIN64 +typedef INT_PTR (WINAPI *FARPROC)(); +typedef INT_PTR (WINAPI *NEARPROC)(); +typedef INT_PTR (WINAPI *PROC)(); +#else +typedef int (WINAPI *FARPROC)(); +typedef int (WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); +#endif + +typedef void *HGDIOBJ; + +DECLARE_HANDLE(HKEY); +typedef HKEY *PHKEY; + +DECLARE_HANDLE(HACCEL); +DECLARE_HANDLE(HBITMAP); +DECLARE_HANDLE(HBRUSH); +DECLARE_HANDLE(HCOLORSPACE); +DECLARE_HANDLE(HDC); +DECLARE_HANDLE(HGLRC); +DECLARE_HANDLE(HDESK); +DECLARE_HANDLE(HENHMETAFILE); +DECLARE_HANDLE(HFONT); +DECLARE_HANDLE(HICON); +DECLARE_HANDLE(HMENU); +DECLARE_HANDLE(HMETAFILE); +DECLARE_HANDLE(HINSTANCE); +typedef HINSTANCE HMODULE; +DECLARE_HANDLE(HPALETTE); +DECLARE_HANDLE(HPEN); +DECLARE_HANDLE(HRGN); +DECLARE_HANDLE(HRSRC); +DECLARE_HANDLE(HSTR); +DECLARE_HANDLE(HTASK); +DECLARE_HANDLE(HWINSTA); +DECLARE_HANDLE(HKL); +DECLARE_HANDLE(HMONITOR); +DECLARE_HANDLE(HWINEVENTHOOK); +DECLARE_HANDLE(HUMPD); + +typedef int HFILE; +typedef HICON HCURSOR; +typedef DWORD COLORREF; +typedef DWORD *LPCOLORREF; + +#define HFILE_ERROR ((HFILE)-1) + +typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT,*PRECT,*NPRECT,*LPRECT; + +typedef const RECT *LPCRECT; + +typedef struct _RECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL,*PRECTL,*LPRECTL; + +typedef const RECTL *LPCRECTL; + +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT,*PPOINT,*NPPOINT,*LPPOINT; + +typedef struct _POINTL { + LONG x; + LONG y; +} POINTL,*PPOINTL; + +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE,*PSIZE,*LPSIZE; + +typedef SIZE SIZEL; +typedef SIZE *PSIZEL,*LPSIZEL; + +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS,*PPOINTS,*LPPOINTS; + +typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME,*PFILETIME,*LPFILETIME; +#define _FILETIME_ + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 /* needed by header files generated by WIDL */ #ifdef __WINESRC__ @@ -98,26 +417,41 @@ extern "C" { # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; #endif +#define UNREFERENCED_PARAMETER(P) {(P)=(P);} +#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} +#define DBG_UNREFERENCED_PARAMETER(P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) + +#ifndef __WATCOMC__ +#ifndef _export +#define _export +#endif +#ifndef __export +#define __export +#endif +#endif + +#if 0 #ifdef __GNUC__ #define PACKED __attribute__((packed)) -#ifndef _fastcall -#define _fastcall __attribute__((fastcall)) -#endif -#ifndef __fastcall -#define __fastcall __attribute__((fastcall)) -#endif -#ifndef _stdcall -#define _stdcall __attribute__((stdcall)) -#endif -#ifndef __stdcall -#define __stdcall __attribute__((stdcall)) -#endif -#ifndef _cdecl -#define _cdecl __attribute__((cdecl)) -#endif -#ifndef __cdecl -#define __cdecl __attribute__((cdecl)) -#endif +//#ifndef _fastcall +//#define _fastcall __attribute__((fastcall)) +//#endif +//#ifndef __fastcall +//#define __fastcall __attribute__((fastcall)) +//#endif +//#ifndef _stdcall +//#define _stdcall __attribute__((stdcall)) +//#endif +//#ifndef __stdcall +//#define __stdcall __attribute__((stdcall)) +//#endif +//#ifndef _cdecl +//#define _cdecl __attribute__((cdecl)) +//#endif +//#ifndef __cdecl +//#define __cdecl __attribute__((cdecl)) +//#endif #ifndef __declspec #define __declspec(e) __attribute__((e)) #endif @@ -131,186 +465,9 @@ extern "C" { #define _cdecl #define __cdecl #endif - -#undef pascal -#undef _pascal -#undef __pascal -#define pascal __stdcall -#define _pascal __stdcall -#define __pascal __stdcall - -#define CDECL _cdecl - -#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) -#define CALLBACK __stdcall -#define WINAPI __stdcall -#define WINAPIV __cdecl -#define APIENTRY WINAPI -#define APIPRIVATE __stdcall -#define PASCAL __stdcall -#else -#define CALLBACK -#define WINAPI -#define WINAPIV -#define APIENTRY WINAPI -#define APIPRIVATE -#define PASCAL pascal #endif -#define DECLSPEC_IMPORT __declspec(dllimport) -#define DECLSPEC_EXPORT __declspec(dllexport) -#ifndef DECLSPEC_NOINLINE -#if (_MSC_VER >= 1300) -#define DECLSPEC_NOINLINE __declspec(noinline) -#elif defined(__GNUC__) -#define DECLSPEC_NOINLINE __attribute__((noinline)) -#else -#define DECLSPEC_NOINLINE -#endif -#endif -#ifdef __GNUC__ -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) __stdcall type -#elif defined(__WATCOMC__) -#define DECLSPEC_NORETURN -#define DECLARE_STDCALL_P( type ) type __stdcall -#elif defined(_MSC_VER) -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) type __stdcall -#endif /* __GNUC__/__WATCOMC__ */ -#define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) -#define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) -#define LOWORD(l) ((WORD)((DWORD_PTR)(l))) -#define HIWORD(l) ((WORD)(((DWORD_PTR)(l)>>16)&0xFFFF)) -#define LOBYTE(w) ((BYTE)(w)) -#define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF)) - -#ifndef __WATCOMC__ -#ifndef _export -#define _export -#endif -#ifndef __export -#define __export -#endif -#endif - -#ifndef NOMINMAX - #ifndef max - #define max(a,b) ((a)>(b)?(a):(b)) - #endif - - #ifndef min - #define min(a,b) ((a)<(b)?(a):(b)) - #endif -#endif - -#define UNREFERENCED_PARAMETER(P) {(P)=(P);} -#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} -#define DBG_UNREFERENCED_PARAMETER(P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) - -#ifndef __ANONYMOUS_DEFINED -#define __ANONYMOUS_DEFINED - -#ifndef NONAMELESSUNION -#ifdef __GNUC__ -#define _ANONYMOUS_UNION __extension__ -#define _ANONYMOUS_STRUCT __extension__ -#elif defined(__WATCOMC__) || defined(_MSC_VER) -#define _ANONYMOUS_UNION -#define _ANONYMOUS_STRUCT -#endif /* __GNUC__/__WATCOMC__ */ -#endif /* NONAMELESSUNION */ - -#ifndef _ANONYMOUS_UNION -#define _ANONYMOUS_UNION -#define _UNION_NAME(x) x -#define DUMMYUNIONNAME u -#define DUMMYUNIONNAME1 u1 -#define DUMMYUNIONNAME2 u2 -#define DUMMYUNIONNAME3 u3 -#define DUMMYUNIONNAME4 u4 -#define DUMMYUNIONNAME5 u5 -#define DUMMYUNIONNAME6 u6 -#define DUMMYUNIONNAME7 u7 -#define DUMMYUNIONNAME8 u8 -#else -#define _UNION_NAME(x) -#define DUMMYUNIONNAME -#define DUMMYUNIONNAME1 -#define DUMMYUNIONNAME2 -#define DUMMYUNIONNAME3 -#define DUMMYUNIONNAME4 -#define DUMMYUNIONNAME5 -#define DUMMYUNIONNAME6 -#define DUMMYUNIONNAME7 -#define DUMMYUNIONNAME8 -#endif -#ifndef _ANONYMOUS_STRUCT -#define _ANONYMOUS_STRUCT -#define _STRUCT_NAME(x) x -#define DUMMYSTRUCTNAME s -#define DUMMYSTRUCTNAME1 s1 -#define DUMMYSTRUCTNAME2 s2 -#define DUMMYSTRUCTNAME3 s3 -#define DUMMYSTRUCTNAME4 s4 -#define DUMMYSTRUCTNAME5 s5 -#else -#define _STRUCT_NAME(x) -#define DUMMYSTRUCTNAME -#define DUMMYSTRUCTNAME1 -#define DUMMYSTRUCTNAME2 -#define DUMMYSTRUCTNAME3 -#define DUMMYSTRUCTNAME4 -#define DUMMYSTRUCTNAME5 -#endif - -#endif /* __ANONYMOUS_DEFINED */ - -#ifndef NO_STRICT -#ifndef STRICT -#define STRICT 1 -#endif -#endif - -#ifndef DWORD_DEFINED -#define DWORD_DEFINED -#ifndef __ROS_LONG64__ - typedef unsigned long DWORD; -#else - typedef unsigned int DWORD; -#endif -#endif//DWORD_DEFINED - -typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; -/* FIXME: Is there a good solution to this? */ -#ifndef XFree86Server -#ifndef __OBJC__ -typedef WINBOOL BOOL; -#else -#define BOOL WINBOOL -#endif -typedef unsigned char BYTE; -#endif /* ndef XFree86Server */ -typedef BOOL *PBOOL,*LPBOOL; -typedef unsigned short WORD; -typedef float FLOAT; -typedef FLOAT *PFLOAT; -typedef BYTE *PBYTE,*LPBYTE; -typedef int *PINT,*LPINT; -typedef WORD *PWORD,*LPWORD; -#ifndef __ROS_LONG64__ -typedef long *LPLONG; -#else -typedef int *LPLONG; -#endif -typedef DWORD *PDWORD,*LPDWORD; -typedef CONST void *LPCVOID; - -typedef unsigned int UINT,*PUINT,*LPUINT; - -typedef void *LPVOID; - +#if 1 // needed by shlwapi.h #ifndef __ms_va_list # if defined(__x86_64__) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list @@ -322,115 +479,7 @@ typedef void *LPVOID; # define __ms_va_end(list) va_end(list) # endif #endif - -// -// Check if ntdef.h already defined these for us -// -#ifndef BASETYPES -#define BASETYPES -#ifndef __ROS_LONG64__ -typedef unsigned long ULONG, *PULONG; -#else -typedef unsigned int ULONG, *PULONG; #endif -typedef unsigned short USHORT, *PUSHORT; -typedef unsigned char UCHAR, *PUCHAR; -typedef char *PSZ; -typedef int INT; -#endif /* BASETYPES */ - -#ifndef NT_INCLUDED -#include -#endif - -typedef HANDLE *LPHANDLE; -typedef UINT_PTR WPARAM; -typedef LONG_PTR LPARAM; -typedef LONG_PTR LRESULT; -#ifndef _HRESULT_DEFINED -typedef LONG HRESULT; -#define _HRESULT_DEFINED -#endif -#ifndef XFree86Server -typedef WORD ATOM; -#endif /* XFree86Server */ -typedef HANDLE HGLOBAL; -typedef HANDLE HLOCAL; -typedef HANDLE GLOBALHANDLE; -typedef HANDLE LOCALHANDLE; -typedef void *HGDIOBJ; -DECLARE_HANDLE(HACCEL); -DECLARE_HANDLE(HBITMAP); -DECLARE_HANDLE(HBRUSH); -DECLARE_HANDLE(HCOLORSPACE); -DECLARE_HANDLE(HDC); -DECLARE_HANDLE(HGLRC); -DECLARE_HANDLE(HDESK); -DECLARE_HANDLE(HENHMETAFILE); -DECLARE_HANDLE(HFONT); -DECLARE_HANDLE(HICON); -DECLARE_HANDLE(HKEY); -/* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */ -/* #if (WINVER >= 0x0500) */ -DECLARE_HANDLE(HMONITOR); -DECLARE_HANDLE(HUMPD); -#define HMONITOR_DECLARED 1 -DECLARE_HANDLE(HTERMINAL); -DECLARE_HANDLE(HWINEVENTHOOK); -/* #endif */ -typedef HKEY *PHKEY; -DECLARE_HANDLE(HMENU); -DECLARE_HANDLE(HMETAFILE); -DECLARE_HANDLE(HINSTANCE); -typedef HINSTANCE HMODULE; -DECLARE_HANDLE(HPALETTE); -DECLARE_HANDLE(HPEN); -DECLARE_HANDLE(HRGN); -DECLARE_HANDLE(HRSRC); -DECLARE_HANDLE(HSTR); -DECLARE_HANDLE(HTASK); -DECLARE_HANDLE(HWND); -DECLARE_HANDLE(HWINSTA); -DECLARE_HANDLE(HKL); -typedef int HFILE; -typedef HICON HCURSOR; -typedef DWORD COLORREF; -typedef DWORD* LPCOLORREF; -#ifdef _WIN64 -typedef INT_PTR (FAR WINAPI *FARPROC)(); -typedef INT_PTR (NEAR WINAPI *NEARPROC)(); -typedef INT_PTR (WINAPI *PROC)(); -#else -typedef int (FAR WINAPI *FARPROC)(); -typedef int (NEAR WINAPI *NEARPROC)(); -typedef int (WINAPI *PROC)(); -#endif -typedef struct tagRECT { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT,*PRECT,*LPRECT; -typedef const RECT *LPCRECT; -typedef struct tagRECTL { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECTL,*PRECTL,*LPRECTL; -typedef const RECTL *LPCRECTL; -typedef struct tagPOINT { - LONG x; - LONG y; -} POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL; -typedef struct tagSIZE { - LONG cx; - LONG cy; -} SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL; -typedef struct tagPOINTS { - SHORT x; - SHORT y; -} POINTS,*PPOINTS,*LPPOINTS; #ifdef _MSC_VER #pragma warning(pop) @@ -439,4 +488,6 @@ typedef struct tagPOINTS { #ifdef __cplusplus } #endif -#endif + +#endif /* _WINDEF_ */ + diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 7967047c4d1..7b2070948a5 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -11,6 +11,62 @@ #include #endif +#ifndef __ANONYMOUS_DEFINED +#define __ANONYMOUS_DEFINED +#ifndef NONAMELESSUNION +#ifdef __GNUC__ +#define _ANONYMOUS_UNION __extension__ +#define _ANONYMOUS_STRUCT __extension__ +#elif defined(__WATCOMC__) || defined(_MSC_VER) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#endif /* __GNUC__/__WATCOMC__ */ +#endif /* NONAMELESSUNION */ +#ifndef _ANONYMOUS_UNION +#define _ANONYMOUS_UNION +#define _UNION_NAME(x) x +#define DUMMYUNIONNAME u +#define DUMMYUNIONNAME1 u1 +#define DUMMYUNIONNAME2 u2 +#define DUMMYUNIONNAME3 u3 +#define DUMMYUNIONNAME4 u4 +#define DUMMYUNIONNAME5 u5 +#define DUMMYUNIONNAME6 u6 +#define DUMMYUNIONNAME7 u7 +#define DUMMYUNIONNAME8 u8 +#else +#define _UNION_NAME(x) +#define DUMMYUNIONNAME +#define DUMMYUNIONNAME1 +#define DUMMYUNIONNAME2 +#define DUMMYUNIONNAME3 +#define DUMMYUNIONNAME4 +#define DUMMYUNIONNAME5 +#define DUMMYUNIONNAME6 +#define DUMMYUNIONNAME7 +#define DUMMYUNIONNAME8 +#endif +#ifndef _ANONYMOUS_STRUCT +#define _ANONYMOUS_STRUCT +#define _STRUCT_NAME(x) x +#define DUMMYSTRUCTNAME s +#define DUMMYSTRUCTNAME1 s1 +#define DUMMYSTRUCTNAME2 s2 +#define DUMMYSTRUCTNAME3 s3 +#define DUMMYSTRUCTNAME4 s4 +#define DUMMYSTRUCTNAME5 s5 +#else +#define _STRUCT_NAME(x) +#define DUMMYSTRUCTNAME +#define DUMMYSTRUCTNAME1 +#define DUMMYSTRUCTNAME2 +#define DUMMYSTRUCTNAME3 +#define DUMMYSTRUCTNAME4 +#define DUMMYSTRUCTNAME5 +#endif +#endif /* __ANONYMOUS_DEFINED */ + + #ifndef DECLSPEC_ALIGN # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) From e690f5af927f50daea225f139039980aacc46289 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 23 Nov 2010 01:16:58 +0000 Subject: [PATCH 053/132] [Win32k] - Restore capturing the hit test in the desktop structure. Move journal record hook before sending the mouse hook. svn path=/trunk/; revision=49719 --- .../subsystems/win32/win32k/ntuser/msgqueue.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index d4a7f22401a..17841567055 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -870,14 +870,6 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT msg->hwnd = UserHMGetHandle(pwndMsg); - /* FIXME: is this really the right place for this hook? */ - event.message = msg->message; - event.time = msg->time; - event.hwnd = msg->hwnd; - event.paramL = msg->pt.x; - event.paramH = msg->pt.y; - co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event ); - #if 0 if (!check_hwnd_filter( msg, hwnd_filter )) RETURN(FALSE); #endif @@ -989,6 +981,15 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT /* message is accepted now (but may still get dropped) */ + pti->rpdesk->htEx = hittest; /* Now set the capture hit. */ + + event.message = msg->message; + event.time = msg->time; + event.hwnd = msg->hwnd; + event.paramL = msg->pt.x; + event.paramH = msg->pt.y; + co_HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event ); + hook.pt = msg->pt; hook.hwnd = msg->hwnd; hook.wHitTestCode = hittest; From 2ce6020471b73149bb5edb21d8288b6d0bb98533 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Nov 2010 01:20:05 +0000 Subject: [PATCH 054/132] revert r49718 svn path=/trunk/; revision=49720 --- reactos/include/psdk/specstrings.h | 273 ----------- reactos/include/psdk/windef.h | 731 ++++++++++++++--------------- reactos/include/psdk/winnt.h | 56 --- 3 files changed, 340 insertions(+), 720 deletions(-) delete mode 100644 reactos/include/psdk/specstrings.h diff --git a/reactos/include/psdk/specstrings.h b/reactos/include/psdk/specstrings.h deleted file mode 100644 index 568bb983e04..00000000000 --- a/reactos/include/psdk/specstrings.h +++ /dev/null @@ -1,273 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#define __specstrings - -#ifdef __cplusplus -#ifndef __nothrow -#define __nothrow __declspec(nothrow) -#endif -#else -#ifndef __nothrow -#define __nothrow -#endif -#endif - -#define __deref_in -#define __deref_in_ecount(size) -#define __deref_in_bcount(size) -#define __deref_in_opt -#define __deref_in_ecount_opt(size) -#define __deref_in_bcount_opt(size) -#define __deref_opt_in -#define __deref_opt_in_ecount(size) -#define __deref_opt_in_bcount(size) -#define __deref_opt_in_opt -#define __deref_opt_in_ecount_opt(size) -#define __deref_opt_in_bcount_opt(size) -#define __out_awcount(expr,size) -#define __in_awcount(expr,size) -#define __null -#define __notnull -#define __maybenull -#define __readonly -#define __notreadonly -#define __maybereadonly -#define __valid -#define __notvalid -#define __maybevalid -#define __readableTo(extent) -#define __elem_readableTo(size) -#define __byte_readableTo(size) -#define __writableTo(size) -#define __elem_writableTo(size) -#define __byte_writableTo(size) -#define __deref -#define __pre -#define __post -#define __precond(expr) -#define __postcond(expr) -#define __exceptthat -#define __execeptthat -#define __inner_success(expr) -#define __inner_checkReturn -#define __inner_typefix(ctype) -#define __inner_override -#define __inner_callback -#define __inner_blocksOn(resource) -#define __inner_fallthrough_dec -#define __inner_fallthrough -#define __refparam -#define __inner_control_entrypoint(category) -#define __inner_data_entrypoint(category) -#define __ecount(size) -#define __bcount(size) -#define __in -#define __in_opt -#define __in_nz -#define __in_nz_opt -#define __in_z -#define __in_z_opt -#define __in_ecount(size) -#define __in_ecount_nz(size) -#define __in_ecount_z(size) -#define __in_bcount(size) -#define __in_bcount_z(size) -#define __in_bcount_nz(size) -#define __in_ecount_opt(size) -#define __in_bcount_opt(size) -#define __in_ecount_z_opt(size) -#define __in_bcount_z_opt(size) -#define __in_ecount_nz_opt(size) -#define __in_bcount_nz_opt(size) -#define __out -#define __out_ecount(size) -#define __out_z -#define __out_nz -#define __out_nz_opt -#define __out_z_opt -#define __out_ecount_part(size,length) -#define __out_ecount_full(size) -#define __out_ecount_nz(size) -#define __out_ecount_z(size) -#define __out_ecount_part_z(size,length) -#define __out_ecount_full_z(size) -#define __out_bcount(size) -#define __out_bcount_part(size,length) -#define __out_bcount_full(size) -#define __out_bcount_z(size) -#define __out_bcount_part_z(size,length) -#define __out_bcount_full_z(size) -#define __out_bcount_nz(size) -#define __inout -#define __inout_ecount(size) -#define __inout_bcount(size) -#define __inout_ecount_part(size,length) -#define __inout_bcount_part(size,length) -#define __inout_ecount_full(size) -#define __inout_bcount_full(size) -#define __inout_z -#define __inout_ecount_z(size) -#define __inout_bcount_z(size) -#define __inout_nz -#define __inout_ecount_nz(size) -#define __inout_bcount_nz(size) -#define __ecount_opt(size) -#define __bcount_opt(size) -#define __out_opt -#define __out_ecount_opt(size) -#define __out_bcount_opt(size) -#define __out_ecount_part_opt(size,length) -#define __out_bcount_part_opt(size,length) -#define __out_ecount_full_opt(size) -#define __out_bcount_full_opt(size) -#define __out_ecount_z_opt(size) -#define __out_bcount_z_opt(size) -#define __out_ecount_part_z_opt(size,length) -#define __out_bcount_part_z_opt(size,length) -#define __out_ecount_full_z_opt(size) -#define __out_bcount_full_z_opt(size) -#define __out_ecount_nz_opt(size) -#define __out_bcount_nz_opt(size) -#define __inout_opt -#define __inout_ecount_opt(size) -#define __inout_bcount_opt(size) -#define __inout_ecount_part_opt(size,length) -#define __inout_bcount_part_opt(size,length) -#define __inout_ecount_full_opt(size) -#define __inout_bcount_full_opt(size) -#define __inout_z_opt -#define __inout_ecount_z_opt(size) -#define __inout_bcount_z_opt(size) -#define __inout_nz_opt -#define __inout_ecount_nz_opt(size) -#define __inout_bcount_nz_opt(size) -#define __deref_ecount(size) -#define __deref_bcount(size) -#define __deref_out -#define __deref_out_ecount(size) -#define __deref_out_bcount(size) -#define __deref_out_ecount_part(size,length) -#define __deref_out_bcount_part(size,length) -#define __deref_out_ecount_full(size) -#define __deref_out_bcount_full(size) -#define __deref_out_z -#define __deref_out_ecount_z(size) -#define __deref_out_bcount_z(size) -#define __deref_out_nz -#define __deref_out_ecount_nz(size) -#define __deref_out_bcount_nz(size) -#define __deref_inout -#define __deref_inout_ecount(size) -#define __deref_inout_bcount(size) -#define __deref_inout_ecount_part(size,length) -#define __deref_inout_bcount_part(size,length) -#define __deref_inout_ecount_full(size) -#define __deref_inout_bcount_full(size) -#define __deref_inout_z -#define __deref_inout_ecount_z(size) -#define __deref_inout_bcount_z(size) -#define __deref_inout_nz -#define __deref_inout_ecount_nz(size) -#define __deref_inout_bcount_nz(size) -#define __deref_ecount_opt(size) -#define __deref_bcount_opt(size) -#define __deref_out_opt -#define __deref_out_ecount_opt(size) -#define __deref_out_bcount_opt(size) -#define __deref_out_ecount_part_opt(size,length) -#define __deref_out_bcount_part_opt(size,length) -#define __deref_out_ecount_full_opt(size) -#define __deref_out_bcount_full_opt(size) -#define __deref_out_z_opt -#define __deref_out_ecount_z_opt(size) -#define __deref_out_bcount_z_opt(size) -#define __deref_out_nz_opt -#define __deref_out_ecount_nz_opt(size) -#define __deref_out_bcount_nz_opt(size) -#define __deref_inout_opt -#define __deref_inout_ecount_opt(size) -#define __deref_inout_bcount_opt(size) -#define __deref_inout_ecount_part_opt(size,length) -#define __deref_inout_bcount_part_opt(size,length) -#define __deref_inout_ecount_full_opt(size) -#define __deref_inout_bcount_full_opt(size) -#define __deref_inout_z_opt -#define __deref_inout_ecount_z_opt(size) -#define __deref_inout_bcount_z_opt(size) -#define __deref_inout_nz_opt -#define __deref_inout_ecount_nz_opt(size) -#define __deref_inout_bcount_nz_opt(size) -#define __deref_opt_ecount(size) -#define __deref_opt_bcount(size) -#define __deref_opt_out -#define __deref_opt_out_z -#define __deref_opt_out_ecount(size) -#define __deref_opt_out_bcount(size) -#define __deref_opt_out_ecount_part(size,length) -#define __deref_opt_out_bcount_part(size,length) -#define __deref_opt_out_ecount_full(size) -#define __deref_opt_out_bcount_full(size) -#define __deref_opt_inout -#define __deref_opt_inout_ecount(size) -#define __deref_opt_inout_bcount(size) -#define __deref_opt_inout_ecount_part(size,length) -#define __deref_opt_inout_bcount_part(size,length) -#define __deref_opt_inout_ecount_full(size) -#define __deref_opt_inout_bcount_full(size) -#define __deref_opt_inout_z -#define __deref_opt_inout_ecount_z(size) -#define __deref_opt_inout_bcount_z(size) -#define __deref_opt_inout_nz -#define __deref_opt_inout_ecount_nz(size) -#define __deref_opt_inout_bcount_nz(size) -#define __deref_opt_ecount_opt(size) -#define __deref_opt_bcount_opt(size) -#define __deref_opt_out_opt -#define __deref_opt_out_ecount_opt(size) -#define __deref_opt_out_bcount_opt(size) -#define __deref_opt_out_ecount_part_opt(size,length) -#define __deref_opt_out_bcount_part_opt(size,length) -#define __deref_opt_out_ecount_full_opt(size) -#define __deref_opt_out_bcount_full_opt(size) -#define __deref_opt_out_z_opt -#define __deref_opt_out_ecount_z_opt(size) -#define __deref_opt_out_bcount_z_opt(size) -#define __deref_opt_out_nz_opt -#define __deref_opt_out_ecount_nz_opt(size) -#define __deref_opt_out_bcount_nz_opt(size) -#define __deref_opt_inout_opt -#define __deref_opt_inout_ecount_opt(size) -#define __deref_opt_inout_bcount_opt(size) -#define __deref_opt_inout_ecount_part_opt(size,length) -#define __deref_opt_inout_bcount_part_opt(size,length) -#define __deref_opt_inout_ecount_full_opt(size) -#define __deref_opt_inout_bcount_full_opt(size) -#define __deref_opt_inout_z_opt -#define __deref_opt_inout_ecount_z_opt(size) -#define __deref_opt_inout_bcount_z_opt(size) -#define __deref_opt_inout_nz_opt -#define __deref_opt_inout_ecount_nz_opt(size) -#define __deref_opt_inout_bcount_nz_opt(size) -#define __success(expr) -#define __nullterminated -#define __nullnullterminated -#define __reserved -#define __checkReturn -#define __typefix(ctype) -#define __override -#define __callback -#define __format_string -#define __blocksOn(resource) -#define __control_entrypoint(category) -#define __data_entrypoint(category) -#ifndef __fallthrough -#define __fallthrough -#endif -#ifndef __analysis_assume -#define __analysis_assume(expr) -#endif - - diff --git a/reactos/include/psdk/windef.h b/reactos/include/psdk/windef.h index 2412dc75705..a29a959e747 100644 --- a/reactos/include/psdk/windef.h +++ b/reactos/include/psdk/windef.h @@ -1,17 +1,5 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#ifndef _WINDEF_ -#define _WINDEF_ - -#define _WINDEF_H // wine ... - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4255) -#endif +#ifndef _WINDEF_H +#define _WINDEF_H #ifndef _M_AMD64 #if !defined(__ROS_LONG64__) @@ -21,68 +9,62 @@ #endif #endif -#ifndef NO_STRICT -#ifndef STRICT -#define STRICT 1 -#endif -#endif - -#ifndef WIN32 -#define WIN32 -#endif - -#if defined(_MAC) && !defined(_WIN32) -#define _WIN32 -#endif - #ifdef __cplusplus extern "C" { #endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4255) +#endif + #ifndef WINVER -#define WINVER 0x0502 +#define WINVER 0x0400 +/* + * If you need Win32 API features newer the Win95 and WinNT then you must + * define WINVER before including windows.h or any other method of including + * the windef.h header. + */ #endif - -#ifndef BASETYPES -#define BASETYPES -#ifndef __ROS_LONG64__ -typedef unsigned long ULONG; -#else -typedef unsigned int ULONG; +#ifndef _WIN32_WINNT +#define _WIN32_WINNT WINVER +/* + * There may be the need to define _WIN32_WINNT to a value different from + * the value of WINVER. I don't have any example of why you would do that. + * However, if you must then define _WIN32_WINNT to the value required before + * including windows.h or any other method of including the windef.h header. + */ +#endif +#ifndef WIN32 +#define WIN32 +#endif +#ifndef _WIN32 +#define _WIN32 +#endif +#define FAR +#define far +#define NEAR +#define near +#ifndef CONST +#define CONST const #endif -typedef ULONG *PULONG; -typedef unsigned short USHORT; -typedef USHORT *PUSHORT; -typedef unsigned char UCHAR; -typedef UCHAR *PUCHAR; -typedef char *PSZ; -typedef int INT; -#endif /* BASETYPES */ - #undef MAX_PATH #define MAX_PATH 260 #ifndef NULL #ifdef __cplusplus -#ifndef _WIN64 #define NULL 0 #else -#define NULL 0LL -#endif /* W64 */ -#else -#define NULL ((void *)0) +#define NULL ((void*)0) #endif #endif - #ifndef FALSE #define FALSE 0 #endif - #ifndef TRUE #define TRUE 1 #endif -#ifndef _NO_W32_PSEUDO_MODIFIERS #ifndef IN #define IN #endif @@ -92,307 +74,6 @@ typedef int INT; #ifndef OPTIONAL #define OPTIONAL #endif -#endif - -#ifdef __GNUC__ -#define PACKED __attribute__((packed)) -#ifndef __declspec -#define __declspec(e) __attribute__((e)) -#endif -#ifndef _declspec -#define _declspec(e) __attribute__((e)) -#endif -#elif defined(__WATCOMC__) -#define PACKED -#else -#define PACKED -#define _cdecl -#define __cdecl -#endif - -#ifdef __GNUC__ -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) __stdcall type -#elif defined(__WATCOMC__) -#define DECLSPEC_NORETURN -#define DECLARE_STDCALL_P( type ) type __stdcall -#elif defined(_MSC_VER) -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) type __stdcall -#endif /* __GNUC__/__WATCOMC__ */ - -#define DECLSPEC_IMPORT __declspec(dllimport) -#define DECLSPEC_EXPORT __declspec(dllexport) -#ifndef DECLSPEC_NOINLINE -#if (_MSC_VER >= 1300) -#define DECLSPEC_NOINLINE __declspec(noinline) -#elif defined(__GNUC__) -#define DECLSPEC_NOINLINE __attribute__((noinline)) -#else -#define DECLSPEC_NOINLINE -#endif -#endif - -#undef far -#undef near -#undef pascal - -#define far -#define near -#define pascal __stdcall - -//#define cdecl _cdecl -#ifndef CDECL -#define CDECL _cdecl -#endif - -#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) -#ifndef CALLBACK -#define CALLBACK __stdcall -#endif -#ifndef WINAPI -#define WINAPI __stdcall -#endif -#define WINAPIV __cdecl -#define APIENTRY WINAPI -#define APIPRIVATE WINAPI -#define PASCAL WINAPI -#else -#define CALLBACK -#define WINAPI -#define WINAPIV -#define APIENTRY WINAPI -#define APIPRIVATE -#define PASCAL pascal -#endif - -#undef FAR -#undef NEAR -#define FAR -#define NEAR - -#ifndef CONST -#define CONST const -#endif - -#ifndef _DEF_WINBOOL_ -#define _DEF_WINBOOL_ -typedef int WINBOOL; -#pragma push_macro("BOOL") -#undef BOOL -#if !defined(__OBJC__) && !defined(__OBJC_BOOL) && !defined(__objc_INCLUDE_GNU) -typedef int BOOL; -#endif -#define BOOL WINBOOL -typedef BOOL *PBOOL; -typedef BOOL *LPBOOL; -#pragma pop_macro("BOOL") -#endif /* _DEF_WINBOOL_ */ - -typedef unsigned char BYTE; -typedef unsigned short WORD; -#ifndef __ROS_LONG64__ - typedef unsigned long DWORD; -#else - typedef unsigned int DWORD; -#endif -typedef float FLOAT; -typedef FLOAT *PFLOAT; -typedef BYTE *PBYTE; -typedef BYTE *LPBYTE; -typedef int *PINT; -typedef int *LPINT; -typedef WORD *PWORD; -typedef WORD *LPWORD; -#ifndef __ROS_LONG64__ -typedef long *LPLONG; -#else -typedef int *LPLONG; -#endif -typedef DWORD *PDWORD; -typedef DWORD *LPDWORD; -typedef void *LPVOID; -#ifndef _LPCVOID_DEFINED -#define _LPCVOID_DEFINED -typedef CONST void *LPCVOID; -#endif -//typedef int INT; -typedef unsigned int UINT; -typedef unsigned int *PUINT; -typedef unsigned int *LPUINT; - - - - -#ifndef NT_INCLUDED -#include -#endif - -#include - -typedef UINT_PTR WPARAM; -typedef LONG_PTR LPARAM; -typedef LONG_PTR LRESULT; -#ifndef _HRESULT_DEFINED -typedef LONG HRESULT; -#define _HRESULT_DEFINED -#endif - -#ifndef NOMINMAX -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#endif - -#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) -#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) -#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) -#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) -#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) -#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) - -#ifndef WIN_INTERNAL -DECLARE_HANDLE (HWND); -//DECLARE_HANDLE (HHOOK); -#ifdef WINABLE -DECLARE_HANDLE (HEVENT); -#endif -#endif - -typedef WORD ATOM; - -typedef HANDLE *SPHANDLE; -typedef HANDLE *LPHANDLE; -typedef HANDLE HGLOBAL; -typedef HANDLE HLOCAL; -typedef HANDLE GLOBALHANDLE; -typedef HANDLE LOCALHANDLE; -#ifdef _WIN64 -typedef INT_PTR (WINAPI *FARPROC)(); -typedef INT_PTR (WINAPI *NEARPROC)(); -typedef INT_PTR (WINAPI *PROC)(); -#else -typedef int (WINAPI *FARPROC)(); -typedef int (WINAPI *NEARPROC)(); -typedef int (WINAPI *PROC)(); -#endif - -typedef void *HGDIOBJ; - -DECLARE_HANDLE(HKEY); -typedef HKEY *PHKEY; - -DECLARE_HANDLE(HACCEL); -DECLARE_HANDLE(HBITMAP); -DECLARE_HANDLE(HBRUSH); -DECLARE_HANDLE(HCOLORSPACE); -DECLARE_HANDLE(HDC); -DECLARE_HANDLE(HGLRC); -DECLARE_HANDLE(HDESK); -DECLARE_HANDLE(HENHMETAFILE); -DECLARE_HANDLE(HFONT); -DECLARE_HANDLE(HICON); -DECLARE_HANDLE(HMENU); -DECLARE_HANDLE(HMETAFILE); -DECLARE_HANDLE(HINSTANCE); -typedef HINSTANCE HMODULE; -DECLARE_HANDLE(HPALETTE); -DECLARE_HANDLE(HPEN); -DECLARE_HANDLE(HRGN); -DECLARE_HANDLE(HRSRC); -DECLARE_HANDLE(HSTR); -DECLARE_HANDLE(HTASK); -DECLARE_HANDLE(HWINSTA); -DECLARE_HANDLE(HKL); -DECLARE_HANDLE(HMONITOR); -DECLARE_HANDLE(HWINEVENTHOOK); -DECLARE_HANDLE(HUMPD); - -typedef int HFILE; -typedef HICON HCURSOR; -typedef DWORD COLORREF; -typedef DWORD *LPCOLORREF; - -#define HFILE_ERROR ((HFILE)-1) - -typedef struct tagRECT { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT,*PRECT,*NPRECT,*LPRECT; - -typedef const RECT *LPCRECT; - -typedef struct _RECTL { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECTL,*PRECTL,*LPRECTL; - -typedef const RECTL *LPCRECTL; - -typedef struct tagPOINT { - LONG x; - LONG y; -} POINT,*PPOINT,*NPPOINT,*LPPOINT; - -typedef struct _POINTL { - LONG x; - LONG y; -} POINTL,*PPOINTL; - -typedef struct tagSIZE { - LONG cx; - LONG cy; -} SIZE,*PSIZE,*LPSIZE; - -typedef SIZE SIZEL; -typedef SIZE *PSIZEL,*LPSIZEL; - -typedef struct tagPOINTS { - SHORT x; - SHORT y; -} POINTS,*PPOINTS,*LPPOINTS; - -typedef struct _FILETIME { - DWORD dwLowDateTime; - DWORD dwHighDateTime; -} FILETIME,*PFILETIME,*LPFILETIME; -#define _FILETIME_ - -#define DM_UPDATE 1 -#define DM_COPY 2 -#define DM_PROMPT 4 -#define DM_MODIFY 8 - -#define DM_IN_BUFFER DM_MODIFY -#define DM_IN_PROMPT DM_PROMPT -#define DM_OUT_BUFFER DM_COPY -#define DM_OUT_DEFAULT DM_UPDATE - -#define DC_FIELDS 1 -#define DC_PAPERS 2 -#define DC_PAPERSIZE 3 -#define DC_MINEXTENT 4 -#define DC_MAXEXTENT 5 -#define DC_BINS 6 -#define DC_DUPLEX 7 -#define DC_SIZE 8 -#define DC_EXTRA 9 -#define DC_VERSION 10 -#define DC_DRIVER 11 -#define DC_BINNAMES 12 -#define DC_ENUMRESOLUTIONS 13 -#define DC_FILEDEPENDENCIES 14 -#define DC_TRUETYPE 15 -#define DC_PAPERNAMES 16 -#define DC_ORIENTATION 17 -#define DC_COPIES 18 /* needed by header files generated by WIDL */ #ifdef __WINESRC__ @@ -417,41 +98,26 @@ typedef struct _FILETIME { # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; #endif -#define UNREFERENCED_PARAMETER(P) {(P)=(P);} -#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} -#define DBG_UNREFERENCED_PARAMETER(P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) - -#ifndef __WATCOMC__ -#ifndef _export -#define _export -#endif -#ifndef __export -#define __export -#endif -#endif - -#if 0 #ifdef __GNUC__ #define PACKED __attribute__((packed)) -//#ifndef _fastcall -//#define _fastcall __attribute__((fastcall)) -//#endif -//#ifndef __fastcall -//#define __fastcall __attribute__((fastcall)) -//#endif -//#ifndef _stdcall -//#define _stdcall __attribute__((stdcall)) -//#endif -//#ifndef __stdcall -//#define __stdcall __attribute__((stdcall)) -//#endif -//#ifndef _cdecl -//#define _cdecl __attribute__((cdecl)) -//#endif -//#ifndef __cdecl -//#define __cdecl __attribute__((cdecl)) -//#endif +#ifndef _fastcall +#define _fastcall __attribute__((fastcall)) +#endif +#ifndef __fastcall +#define __fastcall __attribute__((fastcall)) +#endif +#ifndef _stdcall +#define _stdcall __attribute__((stdcall)) +#endif +#ifndef __stdcall +#define __stdcall __attribute__((stdcall)) +#endif +#ifndef _cdecl +#define _cdecl __attribute__((cdecl)) +#endif +#ifndef __cdecl +#define __cdecl __attribute__((cdecl)) +#endif #ifndef __declspec #define __declspec(e) __attribute__((e)) #endif @@ -465,9 +131,186 @@ typedef struct _FILETIME { #define _cdecl #define __cdecl #endif + +#undef pascal +#undef _pascal +#undef __pascal +#define pascal __stdcall +#define _pascal __stdcall +#define __pascal __stdcall + +#define CDECL _cdecl + +#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) +#define CALLBACK __stdcall +#define WINAPI __stdcall +#define WINAPIV __cdecl +#define APIENTRY WINAPI +#define APIPRIVATE __stdcall +#define PASCAL __stdcall +#else +#define CALLBACK +#define WINAPI +#define WINAPIV +#define APIENTRY WINAPI +#define APIPRIVATE +#define PASCAL pascal #endif -#if 1 // needed by shlwapi.h +#define DECLSPEC_IMPORT __declspec(dllimport) +#define DECLSPEC_EXPORT __declspec(dllexport) +#ifndef DECLSPEC_NOINLINE +#if (_MSC_VER >= 1300) +#define DECLSPEC_NOINLINE __declspec(noinline) +#elif defined(__GNUC__) +#define DECLSPEC_NOINLINE __attribute__((noinline)) +#else +#define DECLSPEC_NOINLINE +#endif +#endif +#ifdef __GNUC__ +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) __stdcall type +#elif defined(__WATCOMC__) +#define DECLSPEC_NORETURN +#define DECLARE_STDCALL_P( type ) type __stdcall +#elif defined(_MSC_VER) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) type __stdcall +#endif /* __GNUC__/__WATCOMC__ */ +#define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) +#define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) +#define LOWORD(l) ((WORD)((DWORD_PTR)(l))) +#define HIWORD(l) ((WORD)(((DWORD_PTR)(l)>>16)&0xFFFF)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF)) + +#ifndef __WATCOMC__ +#ifndef _export +#define _export +#endif +#ifndef __export +#define __export +#endif +#endif + +#ifndef NOMINMAX + #ifndef max + #define max(a,b) ((a)>(b)?(a):(b)) + #endif + + #ifndef min + #define min(a,b) ((a)<(b)?(a):(b)) + #endif +#endif + +#define UNREFERENCED_PARAMETER(P) {(P)=(P);} +#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} +#define DBG_UNREFERENCED_PARAMETER(P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) + +#ifndef __ANONYMOUS_DEFINED +#define __ANONYMOUS_DEFINED + +#ifndef NONAMELESSUNION +#ifdef __GNUC__ +#define _ANONYMOUS_UNION __extension__ +#define _ANONYMOUS_STRUCT __extension__ +#elif defined(__WATCOMC__) || defined(_MSC_VER) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#endif /* __GNUC__/__WATCOMC__ */ +#endif /* NONAMELESSUNION */ + +#ifndef _ANONYMOUS_UNION +#define _ANONYMOUS_UNION +#define _UNION_NAME(x) x +#define DUMMYUNIONNAME u +#define DUMMYUNIONNAME1 u1 +#define DUMMYUNIONNAME2 u2 +#define DUMMYUNIONNAME3 u3 +#define DUMMYUNIONNAME4 u4 +#define DUMMYUNIONNAME5 u5 +#define DUMMYUNIONNAME6 u6 +#define DUMMYUNIONNAME7 u7 +#define DUMMYUNIONNAME8 u8 +#else +#define _UNION_NAME(x) +#define DUMMYUNIONNAME +#define DUMMYUNIONNAME1 +#define DUMMYUNIONNAME2 +#define DUMMYUNIONNAME3 +#define DUMMYUNIONNAME4 +#define DUMMYUNIONNAME5 +#define DUMMYUNIONNAME6 +#define DUMMYUNIONNAME7 +#define DUMMYUNIONNAME8 +#endif +#ifndef _ANONYMOUS_STRUCT +#define _ANONYMOUS_STRUCT +#define _STRUCT_NAME(x) x +#define DUMMYSTRUCTNAME s +#define DUMMYSTRUCTNAME1 s1 +#define DUMMYSTRUCTNAME2 s2 +#define DUMMYSTRUCTNAME3 s3 +#define DUMMYSTRUCTNAME4 s4 +#define DUMMYSTRUCTNAME5 s5 +#else +#define _STRUCT_NAME(x) +#define DUMMYSTRUCTNAME +#define DUMMYSTRUCTNAME1 +#define DUMMYSTRUCTNAME2 +#define DUMMYSTRUCTNAME3 +#define DUMMYSTRUCTNAME4 +#define DUMMYSTRUCTNAME5 +#endif + +#endif /* __ANONYMOUS_DEFINED */ + +#ifndef NO_STRICT +#ifndef STRICT +#define STRICT 1 +#endif +#endif + +#ifndef DWORD_DEFINED +#define DWORD_DEFINED +#ifndef __ROS_LONG64__ + typedef unsigned long DWORD; +#else + typedef unsigned int DWORD; +#endif +#endif//DWORD_DEFINED + +typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; +/* FIXME: Is there a good solution to this? */ +#ifndef XFree86Server +#ifndef __OBJC__ +typedef WINBOOL BOOL; +#else +#define BOOL WINBOOL +#endif +typedef unsigned char BYTE; +#endif /* ndef XFree86Server */ +typedef BOOL *PBOOL,*LPBOOL; +typedef unsigned short WORD; +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BYTE *PBYTE,*LPBYTE; +typedef int *PINT,*LPINT; +typedef WORD *PWORD,*LPWORD; +#ifndef __ROS_LONG64__ +typedef long *LPLONG; +#else +typedef int *LPLONG; +#endif +typedef DWORD *PDWORD,*LPDWORD; +typedef CONST void *LPCVOID; + +typedef unsigned int UINT,*PUINT,*LPUINT; + +typedef void *LPVOID; + #ifndef __ms_va_list # if defined(__x86_64__) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list @@ -479,7 +322,115 @@ typedef struct _FILETIME { # define __ms_va_end(list) va_end(list) # endif #endif + +// +// Check if ntdef.h already defined these for us +// +#ifndef BASETYPES +#define BASETYPES +#ifndef __ROS_LONG64__ +typedef unsigned long ULONG, *PULONG; +#else +typedef unsigned int ULONG, *PULONG; #endif +typedef unsigned short USHORT, *PUSHORT; +typedef unsigned char UCHAR, *PUCHAR; +typedef char *PSZ; +typedef int INT; +#endif /* BASETYPES */ + +#ifndef NT_INCLUDED +#include +#endif + +typedef HANDLE *LPHANDLE; +typedef UINT_PTR WPARAM; +typedef LONG_PTR LPARAM; +typedef LONG_PTR LRESULT; +#ifndef _HRESULT_DEFINED +typedef LONG HRESULT; +#define _HRESULT_DEFINED +#endif +#ifndef XFree86Server +typedef WORD ATOM; +#endif /* XFree86Server */ +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; +typedef void *HGDIOBJ; +DECLARE_HANDLE(HACCEL); +DECLARE_HANDLE(HBITMAP); +DECLARE_HANDLE(HBRUSH); +DECLARE_HANDLE(HCOLORSPACE); +DECLARE_HANDLE(HDC); +DECLARE_HANDLE(HGLRC); +DECLARE_HANDLE(HDESK); +DECLARE_HANDLE(HENHMETAFILE); +DECLARE_HANDLE(HFONT); +DECLARE_HANDLE(HICON); +DECLARE_HANDLE(HKEY); +/* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */ +/* #if (WINVER >= 0x0500) */ +DECLARE_HANDLE(HMONITOR); +DECLARE_HANDLE(HUMPD); +#define HMONITOR_DECLARED 1 +DECLARE_HANDLE(HTERMINAL); +DECLARE_HANDLE(HWINEVENTHOOK); +/* #endif */ +typedef HKEY *PHKEY; +DECLARE_HANDLE(HMENU); +DECLARE_HANDLE(HMETAFILE); +DECLARE_HANDLE(HINSTANCE); +typedef HINSTANCE HMODULE; +DECLARE_HANDLE(HPALETTE); +DECLARE_HANDLE(HPEN); +DECLARE_HANDLE(HRGN); +DECLARE_HANDLE(HRSRC); +DECLARE_HANDLE(HSTR); +DECLARE_HANDLE(HTASK); +DECLARE_HANDLE(HWND); +DECLARE_HANDLE(HWINSTA); +DECLARE_HANDLE(HKL); +typedef int HFILE; +typedef HICON HCURSOR; +typedef DWORD COLORREF; +typedef DWORD* LPCOLORREF; +#ifdef _WIN64 +typedef INT_PTR (FAR WINAPI *FARPROC)(); +typedef INT_PTR (NEAR WINAPI *NEARPROC)(); +typedef INT_PTR (WINAPI *PROC)(); +#else +typedef int (FAR WINAPI *FARPROC)(); +typedef int (NEAR WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); +#endif +typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT,*PRECT,*LPRECT; +typedef const RECT *LPCRECT; +typedef struct tagRECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL,*PRECTL,*LPRECTL; +typedef const RECTL *LPCRECTL; +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL; +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL; +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS,*PPOINTS,*LPPOINTS; #ifdef _MSC_VER #pragma warning(pop) @@ -488,6 +439,4 @@ typedef struct _FILETIME { #ifdef __cplusplus } #endif - -#endif /* _WINDEF_ */ - +#endif diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 7b2070948a5..7967047c4d1 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -11,62 +11,6 @@ #include #endif -#ifndef __ANONYMOUS_DEFINED -#define __ANONYMOUS_DEFINED -#ifndef NONAMELESSUNION -#ifdef __GNUC__ -#define _ANONYMOUS_UNION __extension__ -#define _ANONYMOUS_STRUCT __extension__ -#elif defined(__WATCOMC__) || defined(_MSC_VER) -#define _ANONYMOUS_UNION -#define _ANONYMOUS_STRUCT -#endif /* __GNUC__/__WATCOMC__ */ -#endif /* NONAMELESSUNION */ -#ifndef _ANONYMOUS_UNION -#define _ANONYMOUS_UNION -#define _UNION_NAME(x) x -#define DUMMYUNIONNAME u -#define DUMMYUNIONNAME1 u1 -#define DUMMYUNIONNAME2 u2 -#define DUMMYUNIONNAME3 u3 -#define DUMMYUNIONNAME4 u4 -#define DUMMYUNIONNAME5 u5 -#define DUMMYUNIONNAME6 u6 -#define DUMMYUNIONNAME7 u7 -#define DUMMYUNIONNAME8 u8 -#else -#define _UNION_NAME(x) -#define DUMMYUNIONNAME -#define DUMMYUNIONNAME1 -#define DUMMYUNIONNAME2 -#define DUMMYUNIONNAME3 -#define DUMMYUNIONNAME4 -#define DUMMYUNIONNAME5 -#define DUMMYUNIONNAME6 -#define DUMMYUNIONNAME7 -#define DUMMYUNIONNAME8 -#endif -#ifndef _ANONYMOUS_STRUCT -#define _ANONYMOUS_STRUCT -#define _STRUCT_NAME(x) x -#define DUMMYSTRUCTNAME s -#define DUMMYSTRUCTNAME1 s1 -#define DUMMYSTRUCTNAME2 s2 -#define DUMMYSTRUCTNAME3 s3 -#define DUMMYSTRUCTNAME4 s4 -#define DUMMYSTRUCTNAME5 s5 -#else -#define _STRUCT_NAME(x) -#define DUMMYSTRUCTNAME -#define DUMMYSTRUCTNAME1 -#define DUMMYSTRUCTNAME2 -#define DUMMYSTRUCTNAME3 -#define DUMMYSTRUCTNAME4 -#define DUMMYSTRUCTNAME5 -#endif -#endif /* __ANONYMOUS_DEFINED */ - - #ifndef DECLSPEC_ALIGN # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) From afe4af1acf88a3da8376097da8626ef4ce3bcfda Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Nov 2010 11:30:17 +0000 Subject: [PATCH 055/132] [PSDK] Partly sync windef.h with mingw-w64 and add specstrings.h reverts the previous revert, fixed definition of NULL to __null in stddef.h svn path=/trunk/; revision=49722 --- reactos/include/crt/stddef.h | 19 +- reactos/include/psdk/specstrings.h | 273 +++++++++++ reactos/include/psdk/windef.h | 731 +++++++++++++++-------------- reactos/include/psdk/winnt.h | 56 +++ 4 files changed, 726 insertions(+), 353 deletions(-) create mode 100644 reactos/include/psdk/specstrings.h diff --git a/reactos/include/crt/stddef.h b/reactos/include/crt/stddef.h index 9482677272d..0c366e977fd 100644 --- a/reactos/include/crt/stddef.h +++ b/reactos/include/crt/stddef.h @@ -372,20 +372,13 @@ typedef __WCHAR_TYPE__ wchar_t; #endif /* __sys_stdtypes_h */ /* A null pointer constant. */ - -#if defined (_STDDEF_H) || defined (__need_NULL) -#undef NULL /* in case has defined it. */ -#ifdef __GNUG__ -#define NULL __null -#else /* G++ */ -#ifndef __cplusplus -#define NULL ((void *)0) -#else /* C++ */ +#ifndef NULL +#ifdef __cplusplus #define NULL 0 -#endif /* C++ */ -#endif /* G++ */ -#endif /* NULL not defined and or need NULL. */ -#undef __need_NULL +#else +#define NULL ((void*)0) +#endif +#endif #ifndef offsetof diff --git a/reactos/include/psdk/specstrings.h b/reactos/include/psdk/specstrings.h new file mode 100644 index 00000000000..568bb983e04 --- /dev/null +++ b/reactos/include/psdk/specstrings.h @@ -0,0 +1,273 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#define __specstrings + +#ifdef __cplusplus +#ifndef __nothrow +#define __nothrow __declspec(nothrow) +#endif +#else +#ifndef __nothrow +#define __nothrow +#endif +#endif + +#define __deref_in +#define __deref_in_ecount(size) +#define __deref_in_bcount(size) +#define __deref_in_opt +#define __deref_in_ecount_opt(size) +#define __deref_in_bcount_opt(size) +#define __deref_opt_in +#define __deref_opt_in_ecount(size) +#define __deref_opt_in_bcount(size) +#define __deref_opt_in_opt +#define __deref_opt_in_ecount_opt(size) +#define __deref_opt_in_bcount_opt(size) +#define __out_awcount(expr,size) +#define __in_awcount(expr,size) +#define __null +#define __notnull +#define __maybenull +#define __readonly +#define __notreadonly +#define __maybereadonly +#define __valid +#define __notvalid +#define __maybevalid +#define __readableTo(extent) +#define __elem_readableTo(size) +#define __byte_readableTo(size) +#define __writableTo(size) +#define __elem_writableTo(size) +#define __byte_writableTo(size) +#define __deref +#define __pre +#define __post +#define __precond(expr) +#define __postcond(expr) +#define __exceptthat +#define __execeptthat +#define __inner_success(expr) +#define __inner_checkReturn +#define __inner_typefix(ctype) +#define __inner_override +#define __inner_callback +#define __inner_blocksOn(resource) +#define __inner_fallthrough_dec +#define __inner_fallthrough +#define __refparam +#define __inner_control_entrypoint(category) +#define __inner_data_entrypoint(category) +#define __ecount(size) +#define __bcount(size) +#define __in +#define __in_opt +#define __in_nz +#define __in_nz_opt +#define __in_z +#define __in_z_opt +#define __in_ecount(size) +#define __in_ecount_nz(size) +#define __in_ecount_z(size) +#define __in_bcount(size) +#define __in_bcount_z(size) +#define __in_bcount_nz(size) +#define __in_ecount_opt(size) +#define __in_bcount_opt(size) +#define __in_ecount_z_opt(size) +#define __in_bcount_z_opt(size) +#define __in_ecount_nz_opt(size) +#define __in_bcount_nz_opt(size) +#define __out +#define __out_ecount(size) +#define __out_z +#define __out_nz +#define __out_nz_opt +#define __out_z_opt +#define __out_ecount_part(size,length) +#define __out_ecount_full(size) +#define __out_ecount_nz(size) +#define __out_ecount_z(size) +#define __out_ecount_part_z(size,length) +#define __out_ecount_full_z(size) +#define __out_bcount(size) +#define __out_bcount_part(size,length) +#define __out_bcount_full(size) +#define __out_bcount_z(size) +#define __out_bcount_part_z(size,length) +#define __out_bcount_full_z(size) +#define __out_bcount_nz(size) +#define __inout +#define __inout_ecount(size) +#define __inout_bcount(size) +#define __inout_ecount_part(size,length) +#define __inout_bcount_part(size,length) +#define __inout_ecount_full(size) +#define __inout_bcount_full(size) +#define __inout_z +#define __inout_ecount_z(size) +#define __inout_bcount_z(size) +#define __inout_nz +#define __inout_ecount_nz(size) +#define __inout_bcount_nz(size) +#define __ecount_opt(size) +#define __bcount_opt(size) +#define __out_opt +#define __out_ecount_opt(size) +#define __out_bcount_opt(size) +#define __out_ecount_part_opt(size,length) +#define __out_bcount_part_opt(size,length) +#define __out_ecount_full_opt(size) +#define __out_bcount_full_opt(size) +#define __out_ecount_z_opt(size) +#define __out_bcount_z_opt(size) +#define __out_ecount_part_z_opt(size,length) +#define __out_bcount_part_z_opt(size,length) +#define __out_ecount_full_z_opt(size) +#define __out_bcount_full_z_opt(size) +#define __out_ecount_nz_opt(size) +#define __out_bcount_nz_opt(size) +#define __inout_opt +#define __inout_ecount_opt(size) +#define __inout_bcount_opt(size) +#define __inout_ecount_part_opt(size,length) +#define __inout_bcount_part_opt(size,length) +#define __inout_ecount_full_opt(size) +#define __inout_bcount_full_opt(size) +#define __inout_z_opt +#define __inout_ecount_z_opt(size) +#define __inout_bcount_z_opt(size) +#define __inout_nz_opt +#define __inout_ecount_nz_opt(size) +#define __inout_bcount_nz_opt(size) +#define __deref_ecount(size) +#define __deref_bcount(size) +#define __deref_out +#define __deref_out_ecount(size) +#define __deref_out_bcount(size) +#define __deref_out_ecount_part(size,length) +#define __deref_out_bcount_part(size,length) +#define __deref_out_ecount_full(size) +#define __deref_out_bcount_full(size) +#define __deref_out_z +#define __deref_out_ecount_z(size) +#define __deref_out_bcount_z(size) +#define __deref_out_nz +#define __deref_out_ecount_nz(size) +#define __deref_out_bcount_nz(size) +#define __deref_inout +#define __deref_inout_ecount(size) +#define __deref_inout_bcount(size) +#define __deref_inout_ecount_part(size,length) +#define __deref_inout_bcount_part(size,length) +#define __deref_inout_ecount_full(size) +#define __deref_inout_bcount_full(size) +#define __deref_inout_z +#define __deref_inout_ecount_z(size) +#define __deref_inout_bcount_z(size) +#define __deref_inout_nz +#define __deref_inout_ecount_nz(size) +#define __deref_inout_bcount_nz(size) +#define __deref_ecount_opt(size) +#define __deref_bcount_opt(size) +#define __deref_out_opt +#define __deref_out_ecount_opt(size) +#define __deref_out_bcount_opt(size) +#define __deref_out_ecount_part_opt(size,length) +#define __deref_out_bcount_part_opt(size,length) +#define __deref_out_ecount_full_opt(size) +#define __deref_out_bcount_full_opt(size) +#define __deref_out_z_opt +#define __deref_out_ecount_z_opt(size) +#define __deref_out_bcount_z_opt(size) +#define __deref_out_nz_opt +#define __deref_out_ecount_nz_opt(size) +#define __deref_out_bcount_nz_opt(size) +#define __deref_inout_opt +#define __deref_inout_ecount_opt(size) +#define __deref_inout_bcount_opt(size) +#define __deref_inout_ecount_part_opt(size,length) +#define __deref_inout_bcount_part_opt(size,length) +#define __deref_inout_ecount_full_opt(size) +#define __deref_inout_bcount_full_opt(size) +#define __deref_inout_z_opt +#define __deref_inout_ecount_z_opt(size) +#define __deref_inout_bcount_z_opt(size) +#define __deref_inout_nz_opt +#define __deref_inout_ecount_nz_opt(size) +#define __deref_inout_bcount_nz_opt(size) +#define __deref_opt_ecount(size) +#define __deref_opt_bcount(size) +#define __deref_opt_out +#define __deref_opt_out_z +#define __deref_opt_out_ecount(size) +#define __deref_opt_out_bcount(size) +#define __deref_opt_out_ecount_part(size,length) +#define __deref_opt_out_bcount_part(size,length) +#define __deref_opt_out_ecount_full(size) +#define __deref_opt_out_bcount_full(size) +#define __deref_opt_inout +#define __deref_opt_inout_ecount(size) +#define __deref_opt_inout_bcount(size) +#define __deref_opt_inout_ecount_part(size,length) +#define __deref_opt_inout_bcount_part(size,length) +#define __deref_opt_inout_ecount_full(size) +#define __deref_opt_inout_bcount_full(size) +#define __deref_opt_inout_z +#define __deref_opt_inout_ecount_z(size) +#define __deref_opt_inout_bcount_z(size) +#define __deref_opt_inout_nz +#define __deref_opt_inout_ecount_nz(size) +#define __deref_opt_inout_bcount_nz(size) +#define __deref_opt_ecount_opt(size) +#define __deref_opt_bcount_opt(size) +#define __deref_opt_out_opt +#define __deref_opt_out_ecount_opt(size) +#define __deref_opt_out_bcount_opt(size) +#define __deref_opt_out_ecount_part_opt(size,length) +#define __deref_opt_out_bcount_part_opt(size,length) +#define __deref_opt_out_ecount_full_opt(size) +#define __deref_opt_out_bcount_full_opt(size) +#define __deref_opt_out_z_opt +#define __deref_opt_out_ecount_z_opt(size) +#define __deref_opt_out_bcount_z_opt(size) +#define __deref_opt_out_nz_opt +#define __deref_opt_out_ecount_nz_opt(size) +#define __deref_opt_out_bcount_nz_opt(size) +#define __deref_opt_inout_opt +#define __deref_opt_inout_ecount_opt(size) +#define __deref_opt_inout_bcount_opt(size) +#define __deref_opt_inout_ecount_part_opt(size,length) +#define __deref_opt_inout_bcount_part_opt(size,length) +#define __deref_opt_inout_ecount_full_opt(size) +#define __deref_opt_inout_bcount_full_opt(size) +#define __deref_opt_inout_z_opt +#define __deref_opt_inout_ecount_z_opt(size) +#define __deref_opt_inout_bcount_z_opt(size) +#define __deref_opt_inout_nz_opt +#define __deref_opt_inout_ecount_nz_opt(size) +#define __deref_opt_inout_bcount_nz_opt(size) +#define __success(expr) +#define __nullterminated +#define __nullnullterminated +#define __reserved +#define __checkReturn +#define __typefix(ctype) +#define __override +#define __callback +#define __format_string +#define __blocksOn(resource) +#define __control_entrypoint(category) +#define __data_entrypoint(category) +#ifndef __fallthrough +#define __fallthrough +#endif +#ifndef __analysis_assume +#define __analysis_assume(expr) +#endif + + diff --git a/reactos/include/psdk/windef.h b/reactos/include/psdk/windef.h index a29a959e747..2412dc75705 100644 --- a/reactos/include/psdk/windef.h +++ b/reactos/include/psdk/windef.h @@ -1,5 +1,17 @@ -#ifndef _WINDEF_H -#define _WINDEF_H +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#ifndef _WINDEF_ +#define _WINDEF_ + +#define _WINDEF_H // wine ... + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4255) +#endif #ifndef _M_AMD64 #if !defined(__ROS_LONG64__) @@ -9,62 +21,68 @@ #endif #endif +#ifndef NO_STRICT +#ifndef STRICT +#define STRICT 1 +#endif +#endif + +#ifndef WIN32 +#define WIN32 +#endif + +#if defined(_MAC) && !defined(_WIN32) +#define _WIN32 +#endif + #ifdef __cplusplus extern "C" { #endif -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4255) +#ifndef WINVER +#define WINVER 0x0502 #endif -#ifndef WINVER -#define WINVER 0x0400 -/* - * If you need Win32 API features newer the Win95 and WinNT then you must - * define WINVER before including windows.h or any other method of including - * the windef.h header. - */ -#endif -#ifndef _WIN32_WINNT -#define _WIN32_WINNT WINVER -/* - * There may be the need to define _WIN32_WINNT to a value different from - * the value of WINVER. I don't have any example of why you would do that. - * However, if you must then define _WIN32_WINNT to the value required before - * including windows.h or any other method of including the windef.h header. - */ -#endif -#ifndef WIN32 -#define WIN32 -#endif -#ifndef _WIN32 -#define _WIN32 -#endif -#define FAR -#define far -#define NEAR -#define near -#ifndef CONST -#define CONST const +#ifndef BASETYPES +#define BASETYPES +#ifndef __ROS_LONG64__ +typedef unsigned long ULONG; +#else +typedef unsigned int ULONG; #endif +typedef ULONG *PULONG; +typedef unsigned short USHORT; +typedef USHORT *PUSHORT; +typedef unsigned char UCHAR; +typedef UCHAR *PUCHAR; +typedef char *PSZ; +typedef int INT; +#endif /* BASETYPES */ + #undef MAX_PATH #define MAX_PATH 260 #ifndef NULL #ifdef __cplusplus +#ifndef _WIN64 #define NULL 0 #else -#define NULL ((void*)0) +#define NULL 0LL +#endif /* W64 */ +#else +#define NULL ((void *)0) #endif #endif + #ifndef FALSE #define FALSE 0 #endif + #ifndef TRUE #define TRUE 1 #endif +#ifndef _NO_W32_PSEUDO_MODIFIERS #ifndef IN #define IN #endif @@ -74,6 +92,307 @@ extern "C" { #ifndef OPTIONAL #define OPTIONAL #endif +#endif + +#ifdef __GNUC__ +#define PACKED __attribute__((packed)) +#ifndef __declspec +#define __declspec(e) __attribute__((e)) +#endif +#ifndef _declspec +#define _declspec(e) __attribute__((e)) +#endif +#elif defined(__WATCOMC__) +#define PACKED +#else +#define PACKED +#define _cdecl +#define __cdecl +#endif + +#ifdef __GNUC__ +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) __stdcall type +#elif defined(__WATCOMC__) +#define DECLSPEC_NORETURN +#define DECLARE_STDCALL_P( type ) type __stdcall +#elif defined(_MSC_VER) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) type __stdcall +#endif /* __GNUC__/__WATCOMC__ */ + +#define DECLSPEC_IMPORT __declspec(dllimport) +#define DECLSPEC_EXPORT __declspec(dllexport) +#ifndef DECLSPEC_NOINLINE +#if (_MSC_VER >= 1300) +#define DECLSPEC_NOINLINE __declspec(noinline) +#elif defined(__GNUC__) +#define DECLSPEC_NOINLINE __attribute__((noinline)) +#else +#define DECLSPEC_NOINLINE +#endif +#endif + +#undef far +#undef near +#undef pascal + +#define far +#define near +#define pascal __stdcall + +//#define cdecl _cdecl +#ifndef CDECL +#define CDECL _cdecl +#endif + +#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) +#ifndef CALLBACK +#define CALLBACK __stdcall +#endif +#ifndef WINAPI +#define WINAPI __stdcall +#endif +#define WINAPIV __cdecl +#define APIENTRY WINAPI +#define APIPRIVATE WINAPI +#define PASCAL WINAPI +#else +#define CALLBACK +#define WINAPI +#define WINAPIV +#define APIENTRY WINAPI +#define APIPRIVATE +#define PASCAL pascal +#endif + +#undef FAR +#undef NEAR +#define FAR +#define NEAR + +#ifndef CONST +#define CONST const +#endif + +#ifndef _DEF_WINBOOL_ +#define _DEF_WINBOOL_ +typedef int WINBOOL; +#pragma push_macro("BOOL") +#undef BOOL +#if !defined(__OBJC__) && !defined(__OBJC_BOOL) && !defined(__objc_INCLUDE_GNU) +typedef int BOOL; +#endif +#define BOOL WINBOOL +typedef BOOL *PBOOL; +typedef BOOL *LPBOOL; +#pragma pop_macro("BOOL") +#endif /* _DEF_WINBOOL_ */ + +typedef unsigned char BYTE; +typedef unsigned short WORD; +#ifndef __ROS_LONG64__ + typedef unsigned long DWORD; +#else + typedef unsigned int DWORD; +#endif +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BYTE *PBYTE; +typedef BYTE *LPBYTE; +typedef int *PINT; +typedef int *LPINT; +typedef WORD *PWORD; +typedef WORD *LPWORD; +#ifndef __ROS_LONG64__ +typedef long *LPLONG; +#else +typedef int *LPLONG; +#endif +typedef DWORD *PDWORD; +typedef DWORD *LPDWORD; +typedef void *LPVOID; +#ifndef _LPCVOID_DEFINED +#define _LPCVOID_DEFINED +typedef CONST void *LPCVOID; +#endif +//typedef int INT; +typedef unsigned int UINT; +typedef unsigned int *PUINT; +typedef unsigned int *LPUINT; + + + + +#ifndef NT_INCLUDED +#include +#endif + +#include + +typedef UINT_PTR WPARAM; +typedef LONG_PTR LPARAM; +typedef LONG_PTR LRESULT; +#ifndef _HRESULT_DEFINED +typedef LONG HRESULT; +#define _HRESULT_DEFINED +#endif + +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif + +#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) +#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) +#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) +#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) +#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) +#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) + +#ifndef WIN_INTERNAL +DECLARE_HANDLE (HWND); +//DECLARE_HANDLE (HHOOK); +#ifdef WINABLE +DECLARE_HANDLE (HEVENT); +#endif +#endif + +typedef WORD ATOM; + +typedef HANDLE *SPHANDLE; +typedef HANDLE *LPHANDLE; +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; +#ifdef _WIN64 +typedef INT_PTR (WINAPI *FARPROC)(); +typedef INT_PTR (WINAPI *NEARPROC)(); +typedef INT_PTR (WINAPI *PROC)(); +#else +typedef int (WINAPI *FARPROC)(); +typedef int (WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); +#endif + +typedef void *HGDIOBJ; + +DECLARE_HANDLE(HKEY); +typedef HKEY *PHKEY; + +DECLARE_HANDLE(HACCEL); +DECLARE_HANDLE(HBITMAP); +DECLARE_HANDLE(HBRUSH); +DECLARE_HANDLE(HCOLORSPACE); +DECLARE_HANDLE(HDC); +DECLARE_HANDLE(HGLRC); +DECLARE_HANDLE(HDESK); +DECLARE_HANDLE(HENHMETAFILE); +DECLARE_HANDLE(HFONT); +DECLARE_HANDLE(HICON); +DECLARE_HANDLE(HMENU); +DECLARE_HANDLE(HMETAFILE); +DECLARE_HANDLE(HINSTANCE); +typedef HINSTANCE HMODULE; +DECLARE_HANDLE(HPALETTE); +DECLARE_HANDLE(HPEN); +DECLARE_HANDLE(HRGN); +DECLARE_HANDLE(HRSRC); +DECLARE_HANDLE(HSTR); +DECLARE_HANDLE(HTASK); +DECLARE_HANDLE(HWINSTA); +DECLARE_HANDLE(HKL); +DECLARE_HANDLE(HMONITOR); +DECLARE_HANDLE(HWINEVENTHOOK); +DECLARE_HANDLE(HUMPD); + +typedef int HFILE; +typedef HICON HCURSOR; +typedef DWORD COLORREF; +typedef DWORD *LPCOLORREF; + +#define HFILE_ERROR ((HFILE)-1) + +typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT,*PRECT,*NPRECT,*LPRECT; + +typedef const RECT *LPCRECT; + +typedef struct _RECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL,*PRECTL,*LPRECTL; + +typedef const RECTL *LPCRECTL; + +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT,*PPOINT,*NPPOINT,*LPPOINT; + +typedef struct _POINTL { + LONG x; + LONG y; +} POINTL,*PPOINTL; + +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE,*PSIZE,*LPSIZE; + +typedef SIZE SIZEL; +typedef SIZE *PSIZEL,*LPSIZEL; + +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS,*PPOINTS,*LPPOINTS; + +typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME,*PFILETIME,*LPFILETIME; +#define _FILETIME_ + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 /* needed by header files generated by WIDL */ #ifdef __WINESRC__ @@ -98,26 +417,41 @@ extern "C" { # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; #endif +#define UNREFERENCED_PARAMETER(P) {(P)=(P);} +#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} +#define DBG_UNREFERENCED_PARAMETER(P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) + +#ifndef __WATCOMC__ +#ifndef _export +#define _export +#endif +#ifndef __export +#define __export +#endif +#endif + +#if 0 #ifdef __GNUC__ #define PACKED __attribute__((packed)) -#ifndef _fastcall -#define _fastcall __attribute__((fastcall)) -#endif -#ifndef __fastcall -#define __fastcall __attribute__((fastcall)) -#endif -#ifndef _stdcall -#define _stdcall __attribute__((stdcall)) -#endif -#ifndef __stdcall -#define __stdcall __attribute__((stdcall)) -#endif -#ifndef _cdecl -#define _cdecl __attribute__((cdecl)) -#endif -#ifndef __cdecl -#define __cdecl __attribute__((cdecl)) -#endif +//#ifndef _fastcall +//#define _fastcall __attribute__((fastcall)) +//#endif +//#ifndef __fastcall +//#define __fastcall __attribute__((fastcall)) +//#endif +//#ifndef _stdcall +//#define _stdcall __attribute__((stdcall)) +//#endif +//#ifndef __stdcall +//#define __stdcall __attribute__((stdcall)) +//#endif +//#ifndef _cdecl +//#define _cdecl __attribute__((cdecl)) +//#endif +//#ifndef __cdecl +//#define __cdecl __attribute__((cdecl)) +//#endif #ifndef __declspec #define __declspec(e) __attribute__((e)) #endif @@ -131,186 +465,9 @@ extern "C" { #define _cdecl #define __cdecl #endif - -#undef pascal -#undef _pascal -#undef __pascal -#define pascal __stdcall -#define _pascal __stdcall -#define __pascal __stdcall - -#define CDECL _cdecl - -#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED) -#define CALLBACK __stdcall -#define WINAPI __stdcall -#define WINAPIV __cdecl -#define APIENTRY WINAPI -#define APIPRIVATE __stdcall -#define PASCAL __stdcall -#else -#define CALLBACK -#define WINAPI -#define WINAPIV -#define APIENTRY WINAPI -#define APIPRIVATE -#define PASCAL pascal #endif -#define DECLSPEC_IMPORT __declspec(dllimport) -#define DECLSPEC_EXPORT __declspec(dllexport) -#ifndef DECLSPEC_NOINLINE -#if (_MSC_VER >= 1300) -#define DECLSPEC_NOINLINE __declspec(noinline) -#elif defined(__GNUC__) -#define DECLSPEC_NOINLINE __attribute__((noinline)) -#else -#define DECLSPEC_NOINLINE -#endif -#endif -#ifdef __GNUC__ -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) __stdcall type -#elif defined(__WATCOMC__) -#define DECLSPEC_NORETURN -#define DECLARE_STDCALL_P( type ) type __stdcall -#elif defined(_MSC_VER) -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P( type ) type __stdcall -#endif /* __GNUC__/__WATCOMC__ */ -#define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) -#define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) -#define LOWORD(l) ((WORD)((DWORD_PTR)(l))) -#define HIWORD(l) ((WORD)(((DWORD_PTR)(l)>>16)&0xFFFF)) -#define LOBYTE(w) ((BYTE)(w)) -#define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF)) - -#ifndef __WATCOMC__ -#ifndef _export -#define _export -#endif -#ifndef __export -#define __export -#endif -#endif - -#ifndef NOMINMAX - #ifndef max - #define max(a,b) ((a)>(b)?(a):(b)) - #endif - - #ifndef min - #define min(a,b) ((a)<(b)?(a):(b)) - #endif -#endif - -#define UNREFERENCED_PARAMETER(P) {(P)=(P);} -#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} -#define DBG_UNREFERENCED_PARAMETER(P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) - -#ifndef __ANONYMOUS_DEFINED -#define __ANONYMOUS_DEFINED - -#ifndef NONAMELESSUNION -#ifdef __GNUC__ -#define _ANONYMOUS_UNION __extension__ -#define _ANONYMOUS_STRUCT __extension__ -#elif defined(__WATCOMC__) || defined(_MSC_VER) -#define _ANONYMOUS_UNION -#define _ANONYMOUS_STRUCT -#endif /* __GNUC__/__WATCOMC__ */ -#endif /* NONAMELESSUNION */ - -#ifndef _ANONYMOUS_UNION -#define _ANONYMOUS_UNION -#define _UNION_NAME(x) x -#define DUMMYUNIONNAME u -#define DUMMYUNIONNAME1 u1 -#define DUMMYUNIONNAME2 u2 -#define DUMMYUNIONNAME3 u3 -#define DUMMYUNIONNAME4 u4 -#define DUMMYUNIONNAME5 u5 -#define DUMMYUNIONNAME6 u6 -#define DUMMYUNIONNAME7 u7 -#define DUMMYUNIONNAME8 u8 -#else -#define _UNION_NAME(x) -#define DUMMYUNIONNAME -#define DUMMYUNIONNAME1 -#define DUMMYUNIONNAME2 -#define DUMMYUNIONNAME3 -#define DUMMYUNIONNAME4 -#define DUMMYUNIONNAME5 -#define DUMMYUNIONNAME6 -#define DUMMYUNIONNAME7 -#define DUMMYUNIONNAME8 -#endif -#ifndef _ANONYMOUS_STRUCT -#define _ANONYMOUS_STRUCT -#define _STRUCT_NAME(x) x -#define DUMMYSTRUCTNAME s -#define DUMMYSTRUCTNAME1 s1 -#define DUMMYSTRUCTNAME2 s2 -#define DUMMYSTRUCTNAME3 s3 -#define DUMMYSTRUCTNAME4 s4 -#define DUMMYSTRUCTNAME5 s5 -#else -#define _STRUCT_NAME(x) -#define DUMMYSTRUCTNAME -#define DUMMYSTRUCTNAME1 -#define DUMMYSTRUCTNAME2 -#define DUMMYSTRUCTNAME3 -#define DUMMYSTRUCTNAME4 -#define DUMMYSTRUCTNAME5 -#endif - -#endif /* __ANONYMOUS_DEFINED */ - -#ifndef NO_STRICT -#ifndef STRICT -#define STRICT 1 -#endif -#endif - -#ifndef DWORD_DEFINED -#define DWORD_DEFINED -#ifndef __ROS_LONG64__ - typedef unsigned long DWORD; -#else - typedef unsigned int DWORD; -#endif -#endif//DWORD_DEFINED - -typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; -/* FIXME: Is there a good solution to this? */ -#ifndef XFree86Server -#ifndef __OBJC__ -typedef WINBOOL BOOL; -#else -#define BOOL WINBOOL -#endif -typedef unsigned char BYTE; -#endif /* ndef XFree86Server */ -typedef BOOL *PBOOL,*LPBOOL; -typedef unsigned short WORD; -typedef float FLOAT; -typedef FLOAT *PFLOAT; -typedef BYTE *PBYTE,*LPBYTE; -typedef int *PINT,*LPINT; -typedef WORD *PWORD,*LPWORD; -#ifndef __ROS_LONG64__ -typedef long *LPLONG; -#else -typedef int *LPLONG; -#endif -typedef DWORD *PDWORD,*LPDWORD; -typedef CONST void *LPCVOID; - -typedef unsigned int UINT,*PUINT,*LPUINT; - -typedef void *LPVOID; - +#if 1 // needed by shlwapi.h #ifndef __ms_va_list # if defined(__x86_64__) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list @@ -322,115 +479,7 @@ typedef void *LPVOID; # define __ms_va_end(list) va_end(list) # endif #endif - -// -// Check if ntdef.h already defined these for us -// -#ifndef BASETYPES -#define BASETYPES -#ifndef __ROS_LONG64__ -typedef unsigned long ULONG, *PULONG; -#else -typedef unsigned int ULONG, *PULONG; #endif -typedef unsigned short USHORT, *PUSHORT; -typedef unsigned char UCHAR, *PUCHAR; -typedef char *PSZ; -typedef int INT; -#endif /* BASETYPES */ - -#ifndef NT_INCLUDED -#include -#endif - -typedef HANDLE *LPHANDLE; -typedef UINT_PTR WPARAM; -typedef LONG_PTR LPARAM; -typedef LONG_PTR LRESULT; -#ifndef _HRESULT_DEFINED -typedef LONG HRESULT; -#define _HRESULT_DEFINED -#endif -#ifndef XFree86Server -typedef WORD ATOM; -#endif /* XFree86Server */ -typedef HANDLE HGLOBAL; -typedef HANDLE HLOCAL; -typedef HANDLE GLOBALHANDLE; -typedef HANDLE LOCALHANDLE; -typedef void *HGDIOBJ; -DECLARE_HANDLE(HACCEL); -DECLARE_HANDLE(HBITMAP); -DECLARE_HANDLE(HBRUSH); -DECLARE_HANDLE(HCOLORSPACE); -DECLARE_HANDLE(HDC); -DECLARE_HANDLE(HGLRC); -DECLARE_HANDLE(HDESK); -DECLARE_HANDLE(HENHMETAFILE); -DECLARE_HANDLE(HFONT); -DECLARE_HANDLE(HICON); -DECLARE_HANDLE(HKEY); -/* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */ -/* #if (WINVER >= 0x0500) */ -DECLARE_HANDLE(HMONITOR); -DECLARE_HANDLE(HUMPD); -#define HMONITOR_DECLARED 1 -DECLARE_HANDLE(HTERMINAL); -DECLARE_HANDLE(HWINEVENTHOOK); -/* #endif */ -typedef HKEY *PHKEY; -DECLARE_HANDLE(HMENU); -DECLARE_HANDLE(HMETAFILE); -DECLARE_HANDLE(HINSTANCE); -typedef HINSTANCE HMODULE; -DECLARE_HANDLE(HPALETTE); -DECLARE_HANDLE(HPEN); -DECLARE_HANDLE(HRGN); -DECLARE_HANDLE(HRSRC); -DECLARE_HANDLE(HSTR); -DECLARE_HANDLE(HTASK); -DECLARE_HANDLE(HWND); -DECLARE_HANDLE(HWINSTA); -DECLARE_HANDLE(HKL); -typedef int HFILE; -typedef HICON HCURSOR; -typedef DWORD COLORREF; -typedef DWORD* LPCOLORREF; -#ifdef _WIN64 -typedef INT_PTR (FAR WINAPI *FARPROC)(); -typedef INT_PTR (NEAR WINAPI *NEARPROC)(); -typedef INT_PTR (WINAPI *PROC)(); -#else -typedef int (FAR WINAPI *FARPROC)(); -typedef int (NEAR WINAPI *NEARPROC)(); -typedef int (WINAPI *PROC)(); -#endif -typedef struct tagRECT { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT,*PRECT,*LPRECT; -typedef const RECT *LPCRECT; -typedef struct tagRECTL { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECTL,*PRECTL,*LPRECTL; -typedef const RECTL *LPCRECTL; -typedef struct tagPOINT { - LONG x; - LONG y; -} POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL; -typedef struct tagSIZE { - LONG cx; - LONG cy; -} SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL; -typedef struct tagPOINTS { - SHORT x; - SHORT y; -} POINTS,*PPOINTS,*LPPOINTS; #ifdef _MSC_VER #pragma warning(pop) @@ -439,4 +488,6 @@ typedef struct tagPOINTS { #ifdef __cplusplus } #endif -#endif + +#endif /* _WINDEF_ */ + diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 7967047c4d1..7b2070948a5 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -11,6 +11,62 @@ #include #endif +#ifndef __ANONYMOUS_DEFINED +#define __ANONYMOUS_DEFINED +#ifndef NONAMELESSUNION +#ifdef __GNUC__ +#define _ANONYMOUS_UNION __extension__ +#define _ANONYMOUS_STRUCT __extension__ +#elif defined(__WATCOMC__) || defined(_MSC_VER) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#endif /* __GNUC__/__WATCOMC__ */ +#endif /* NONAMELESSUNION */ +#ifndef _ANONYMOUS_UNION +#define _ANONYMOUS_UNION +#define _UNION_NAME(x) x +#define DUMMYUNIONNAME u +#define DUMMYUNIONNAME1 u1 +#define DUMMYUNIONNAME2 u2 +#define DUMMYUNIONNAME3 u3 +#define DUMMYUNIONNAME4 u4 +#define DUMMYUNIONNAME5 u5 +#define DUMMYUNIONNAME6 u6 +#define DUMMYUNIONNAME7 u7 +#define DUMMYUNIONNAME8 u8 +#else +#define _UNION_NAME(x) +#define DUMMYUNIONNAME +#define DUMMYUNIONNAME1 +#define DUMMYUNIONNAME2 +#define DUMMYUNIONNAME3 +#define DUMMYUNIONNAME4 +#define DUMMYUNIONNAME5 +#define DUMMYUNIONNAME6 +#define DUMMYUNIONNAME7 +#define DUMMYUNIONNAME8 +#endif +#ifndef _ANONYMOUS_STRUCT +#define _ANONYMOUS_STRUCT +#define _STRUCT_NAME(x) x +#define DUMMYSTRUCTNAME s +#define DUMMYSTRUCTNAME1 s1 +#define DUMMYSTRUCTNAME2 s2 +#define DUMMYSTRUCTNAME3 s3 +#define DUMMYSTRUCTNAME4 s4 +#define DUMMYSTRUCTNAME5 s5 +#else +#define _STRUCT_NAME(x) +#define DUMMYSTRUCTNAME +#define DUMMYSTRUCTNAME1 +#define DUMMYSTRUCTNAME2 +#define DUMMYSTRUCTNAME3 +#define DUMMYSTRUCTNAME4 +#define DUMMYSTRUCTNAME5 +#endif +#endif /* __ANONYMOUS_DEFINED */ + + #ifndef DECLSPEC_ALIGN # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) From eb64df8ebdc2c2d06c141c0a352acb4152a2a862 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Nov 2010 11:47:50 +0000 Subject: [PATCH 056/132] [PSDK] Don't define __in and __null on c++ build. as long as we keep using host headers, this won't work svn path=/trunk/; revision=49723 --- reactos/include/psdk/specstrings.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/include/psdk/specstrings.h b/reactos/include/psdk/specstrings.h index 568bb983e04..de2c0bae219 100644 --- a/reactos/include/psdk/specstrings.h +++ b/reactos/include/psdk/specstrings.h @@ -29,7 +29,9 @@ #define __deref_opt_in_bcount_opt(size) #define __out_awcount(expr,size) #define __in_awcount(expr,size) +#ifndef __cplusplus #define __null +#endif #define __notnull #define __maybenull #define __readonly @@ -64,7 +66,9 @@ #define __inner_data_entrypoint(category) #define __ecount(size) #define __bcount(size) +#ifndef __cplusplus #define __in +#endif #define __in_opt #define __in_nz #define __in_nz_opt @@ -270,4 +274,5 @@ #define __analysis_assume(expr) #endif +//#endif From 90b23eee60c7116b3624df4c5ad40a25a7a1980e Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Tue, 23 Nov 2010 16:08:39 +0000 Subject: [PATCH 057/132] [PSDK] Comment out specstrings.h inclusion in windef.h as per Timo's request. Fixes build. svn path=/trunk/; revision=49724 --- reactos/include/psdk/windef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/psdk/windef.h b/reactos/include/psdk/windef.h index 2412dc75705..1fa768b2ecd 100644 --- a/reactos/include/psdk/windef.h +++ b/reactos/include/psdk/windef.h @@ -228,7 +228,7 @@ typedef unsigned int *LPUINT; #include #endif -#include +//#include typedef UINT_PTR WPARAM; typedef LONG_PTR LPARAM; From 49914debb9d014c9849b4a23f4f91c7c5fcf8200 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Tue, 23 Nov 2010 16:32:18 +0000 Subject: [PATCH 058/132] [ARM]: Our new target is the ZOOM2 OMAP3, instead of Beagle (but we'll keep testing both). svn path=/trunk/; revision=49725 --- reactos/config-arm.template.rbuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/config-arm.template.rbuild b/reactos/config-arm.template.rbuild index dca25d53c0f..08000f9f6e7 100644 --- a/reactos/config-arm.template.rbuild +++ b/reactos/config-arm.template.rbuild @@ -15,10 +15,10 @@ - + + + + + + + + + + From 1a6196d960424f6850b6a6a5e00c382bfbe1f982 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 16:09:19 +0000 Subject: [PATCH 105/132] [NTOS]: Add MiGetPteOffset for ARM. All of the kernel compiles, but does not link yet. svn path=/trunk/; revision=49778 --- reactos/ntoskrnl/include/internal/arm/mm.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/arm/mm.h b/reactos/ntoskrnl/include/internal/arm/mm.h index f70f5c46f21..b73179c6359 100644 --- a/reactos/ntoskrnl/include/internal/arm/mm.h +++ b/reactos/ntoskrnl/include/internal/arm/mm.h @@ -150,8 +150,9 @@ PULONG MmGetPageDirectory(VOID); #define MiAddressToPte(x) MiGetPteAddress(x) /* Retrives the PDE offset for the given VA */ -#define MiGetPdeOffset(x) (((ULONG)(x)) >> 20) -//#define MiGetPteOffset(x) (((ULONG)(x)) >> 12) +#define MiGetPdeOffset(x) (((ULONG)(x)) >> 20) +#define MiGetPteOffset(x) ((((ULONG)(x)) << 12) >> 24) +#define MiAddressToPteOffset(x) MiGetPteOffset(x) /* Convert a PTE into a corresponding address */ #define MiPteToAddress(x) ((PVOID)((ULONG)(x) << 10)) From 85adb4ff8048f1dbb3dbe8aad8f7bed8e4a2c6a1 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 24 Nov 2010 17:24:54 +0000 Subject: [PATCH 106/132] [NTOSKRNL] That's not because ARM will rule the world on a day that you're obliged to break x86 build. Fixed build. Will it work? Only God knows. svn path=/trunk/; revision=49779 --- reactos/ntoskrnl/include/internal/i386/mm.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/include/internal/i386/mm.h b/reactos/ntoskrnl/include/internal/i386/mm.h index e8cfd55ae77..2f70fd5e2f3 100644 --- a/reactos/ntoskrnl/include/internal/i386/mm.h +++ b/reactos/ntoskrnl/include/internal/i386/mm.h @@ -39,6 +39,7 @@ PULONG MmGetPageDirectory(VOID); // Convert a PTE into a corresponding address // #define MiPteToAddress(PTE) ((PVOID)((ULONG)(PTE) << 10)) +#define MiPdeToAddress(PDE) ((PVOID)((ULONG)(PDE) << 18)) #define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (1024 * PAGE_SIZE)) #define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (1024 * PAGE_SIZE))) @@ -55,7 +56,7 @@ PULONG MmGetPageDirectory(VOID); #define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1) #define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1) #define MI_PAGE_WRITE_COMBINED(x) ((x)->u.Hard.WriteThrough = 0) -#define MI_IS_PAGE_LARGE(x) ((x)->u.Hard.Large == 1) +#define MI_IS_PAGE_LARGE(x) ((x)->u.Hard.LargePage == 1) #if !defined(CONFIG_SMP) #define MI_IS_PAGE_WRITEABLE(x) ((x)->u.Hard.Write == 1) #else @@ -81,6 +82,18 @@ PULONG MmGetPageDirectory(VOID); #define TEB_BASE 0x7FFDE000 +#define MI_HYPERSPACE_PTES (256 - 1) +#define MI_ZERO_PTES (32) +#define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE +#define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \ + MI_HYPERSPACE_PTES * PAGE_SIZE) +#define MI_DUMMY_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ + PAGE_SIZE) +#define MI_VAD_BITMAP (PMMPTE)(MI_DUMMY_PTE + \ + PAGE_SIZE) +#define MI_WORKING_SET_LIST (PMMPTE)(MI_VAD_BITMAP + \ + PAGE_SIZE) + /* On x86, these two are the same */ #define MMPDE MMPTE #define PMMPDE PMMPTE From a19af9c7cb42ea6a9957d108f7e066a458d02bd8 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 17:26:30 +0000 Subject: [PATCH 107/132] [NDK]: Fix definition of ARM PTE/PDE structure. [NTOS]: Fix up ARM code to match recent ARM3 changes. [NTOS]: Do not use initguid inside every single file to zillionplicate the GUIDs! Why doesn't the x86 linker catch this?!!? [ARMDDK]: Define some spinlock functions. svn path=/trunk/; revision=49780 --- .../freeldr/freeldr/windows/arm/wlmemory.c | 2 +- reactos/include/ddk/wdm.h | 2 +- reactos/include/ndk/arm/mmtypes.h | 74 +++++----- reactos/include/reactos/arm/armddk.h | 29 ++++ reactos/ntoskrnl/include/internal/po.h | 2 +- reactos/ntoskrnl/mm/ARM3/arm/init.c | 13 +- reactos/ntoskrnl/mm/ARM3/miarm.h | 20 ++- reactos/ntoskrnl/mm/arm/page.c | 131 ++++++++++++++---- reactos/ntoskrnl/mm/arm/stubs.c | 36 ----- reactos/ntoskrnl/po/power.c | 1 + 10 files changed, 189 insertions(+), 121 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/windows/arm/wlmemory.c b/reactos/boot/freeldr/freeldr/windows/arm/wlmemory.c index 994089bdb0b..37356a4107f 100644 --- a/reactos/boot/freeldr/freeldr/windows/arm/wlmemory.c +++ b/reactos/boot/freeldr/freeldr/windows/arm/wlmemory.c @@ -200,7 +200,7 @@ MempAllocatePageTables(VOID) PFN_NUMBER Pfn; /* Setup templates */ - TempPte.Accessed = TempPte.Valid = TempLargePte.LargePage = TempLargePte.Accessed = TempPde.Valid = 1; + TempPte.Sbo = TempPte.Valid = TempLargePte.LargePage = TempLargePte.Sbo = TempPde.Valid = 1; /* Allocate the 1MB "PDR" (Processor Data Region). Must be 1MB aligned */ PdrPage = MmAllocateMemoryAtAddress(sizeof(KPDR_PAGE), diff --git a/reactos/include/ddk/wdm.h b/reactos/include/ddk/wdm.h index 233a0c96a4b..05f57a0d23f 100644 --- a/reactos/include/ddk/wdm.h +++ b/reactos/include/ddk/wdm.h @@ -9726,7 +9726,7 @@ KeQuerySystemTime( OUT PLARGE_INTEGER CurrentTime); #endif /* !_M_AMD64 */ -#if !defined(_X86_) +#if !defined(_X86_) && !defined(_M_ARM) NTKERNELAPI KIRQL NTAPI diff --git a/reactos/include/ndk/arm/mmtypes.h b/reactos/include/ndk/arm/mmtypes.h index febadda1cd5..371b1594368 100644 --- a/reactos/include/ndk/arm/mmtypes.h +++ b/reactos/include/ndk/arm/mmtypes.h @@ -68,7 +68,7 @@ typedef struct _HARDWARE_LARGE_PTE_ARMV6 ULONG NoExecute:1; ULONG Domain:4; ULONG Ecc:1; - ULONG Accessed:1; + ULONG Sbo:1; ULONG Owner:1; ULONG CacheAttributes:3; ULONG ReadOnly:1; @@ -85,7 +85,7 @@ typedef struct _HARDWARE_PTE_ARMV6 ULONG Valid:1; ULONG Buffered:1; ULONG Cached:1; - ULONG Accessed:1; + ULONG Sbo:1; ULONG Owner:1; ULONG CacheAttributes:3; ULONG ReadOnly:1; @@ -100,9 +100,9 @@ C_ASSERT(sizeof(HARDWARE_PTE_ARMV6) == sizeof(ULONG)); typedef struct _MMPTE_SOFTWARE { - ULONG Valid:1; + ULONG Valid:2; ULONG PageFileLow:4; - ULONG Protection:5; + ULONG Protection:4; ULONG Prototype:1; ULONG Transition:1; ULONG PageFileHigh:20; @@ -110,12 +110,12 @@ typedef struct _MMPTE_SOFTWARE typedef struct _MMPTE_TRANSITION { - ULONG Valid:1; - ULONG Write:1; + ULONG Valid:2; + ULONG Buffered:1; + ULONG Cached:1; ULONG Owner:1; - ULONG WriteThrough:1; - ULONG CacheDisable:1; - ULONG Protection:5; + ULONG Protection:4; + ULONG ReadOnly:1; ULONG Prototype:1; ULONG Transition:1; ULONG PageFrameNumber:20; @@ -123,19 +123,18 @@ typedef struct _MMPTE_TRANSITION typedef struct _MMPTE_PROTOTYPE { - ULONG Valid:1; + ULONG Valid:2; ULONG ProtoAddressLow:7; ULONG ReadOnly:1; - ULONG WhichPool:1; ULONG Prototype:1; ULONG ProtoAddressHigh:21; } MMPTE_PROTOTYPE; typedef struct _MMPTE_SUBSECTION { - ULONG Valid:1; + ULONG Valid:2; ULONG SubsectionAddressLow:4; - ULONG Protection:5; + ULONG Protection:4; ULONG Prototype:1; ULONG SubsectionAddressHigh:20; ULONG WhichPool:1; @@ -143,47 +142,38 @@ typedef struct _MMPTE_SUBSECTION typedef struct _MMPTE_LIST { - ULONG Valid:1; + ULONG Valid:2; ULONG OneEntry:1; ULONG filler0:8; ULONG NextEntry:20; ULONG Prototype:1; - ULONG filler1:1; } MMPTE_LIST; typedef union _MMPTE_HARDWARE { - struct - { - ULONG NoExecute:1; - ULONG Valid:1; - ULONG Buffered:1; - ULONG Cached:1; - ULONG Access:1; - ULONG Owner:1; - ULONG CacheAttributes:3; - ULONG ReadOnly:1; - ULONG Shared:1; - ULONG NonGlobal:1; - ULONG PageFrameNumber:20; - }; - ULONG AsUlong; + ULONG NoExecute:1; + ULONG Valid:1; + ULONG Buffered:1; + ULONG Cached:1; + ULONG Sbo:1; + ULONG Owner:1; + ULONG CacheAttributes:3; + ULONG ReadOnly:1; + ULONG Prototype:1; + ULONG NonGlobal:1; + ULONG PageFrameNumber:20; } MMPTE_HARDWARE, *PMMPTE_HARDWARE; typedef union _MMPDE_HARDWARE { - struct - { - ULONG Valid:1; - ULONG LargePage:1; - ULONG Buffered:1; - ULONG Cached:1; - ULONG NoExecute:1; - ULONG Domain:4; - ULONG Ecc:1; - ULONG PageFrameNumber:22; - }; - ULONG AsUlong; + ULONG Valid:1; + ULONG LargePage:1; + ULONG Buffered:1; + ULONG Cached:1; + ULONG NoExecute:1; + ULONG Domain:4; + ULONG Ecc:1; + ULONG PageFrameNumber:22; } MMPDE_HARDWARE, *PMMPDE_HARDWARE; typedef struct _MMPDE diff --git a/reactos/include/reactos/arm/armddk.h b/reactos/include/reactos/arm/armddk.h index e068e5c9643..97d7298b717 100644 --- a/reactos/include/reactos/arm/armddk.h +++ b/reactos/include/reactos/arm/armddk.h @@ -252,6 +252,35 @@ KeRaiseIrqlToDpcLevel( #define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql) #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql) +NTHALAPI +KIRQL +FASTCALL +KfAcquireSpinLock( + IN OUT PKSPIN_LOCK SpinLock); +#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a) + +NTHALAPI +VOID +FASTCALL +KfReleaseSpinLock( + IN OUT PKSPIN_LOCK SpinLock, + IN KIRQL NewIrql); +#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b) + +NTKERNELAPI +VOID +FASTCALL +KefAcquireSpinLockAtDpcLevel( + IN OUT PKSPIN_LOCK SpinLock); +#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock) + +NTKERNELAPI +VOID +FASTCALL +KefReleaseSpinLockFromDpcLevel( + IN OUT PKSPIN_LOCK SpinLock); +#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock) + // // Cache clean and flush // diff --git a/reactos/ntoskrnl/include/internal/po.h b/reactos/ntoskrnl/include/internal/po.h index ef4ee1a5ff1..86e25595164 100644 --- a/reactos/ntoskrnl/include/internal/po.h +++ b/reactos/ntoskrnl/include/internal/po.h @@ -6,7 +6,7 @@ * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) */ -#include "initguid.h" +#include #include // diff --git a/reactos/ntoskrnl/mm/ARM3/arm/init.c b/reactos/ntoskrnl/mm/ARM3/arm/init.c index b7bfd841220..1e44b767d35 100644 --- a/reactos/ntoskrnl/mm/ARM3/arm/init.c +++ b/reactos/ntoskrnl/mm/ARM3/arm/init.c @@ -24,10 +24,7 @@ ULONG MmMaximumNonPagedPoolInBytes; PVOID MmNonPagedSystemStart; PVOID MmNonPagedPoolStart; PVOID MmNonPagedPoolExpansionStart; -PVOID MmNonPagedPoolEnd = MI_NONPAGED_POOL_END; -PVOID MmPagedPoolStart = MI_PAGED_POOL_START; PVOID MmPagedPoolEnd; -ULONG MmSizeOfPagedPoolInBytes = MI_MIN_INIT_PAGED_POOLSIZE; PVOID MiSessionSpaceEnd; PVOID MiSessionImageEnd; PVOID MiSessionImageStart; @@ -49,7 +46,7 @@ RTL_BITMAP MiPfnBitMap; PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor; MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; -ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage = -1; +ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage; ULONG MmBootImageSize; ULONG MmUserProbeAddress; PVOID MmHighestUserAddress; @@ -61,17 +58,17 @@ PVOID MmHyperSpaceEnd; /* PRIVATE FUNCTIONS **********************************************************/ -BOOLEAN +NTSTATUS NTAPI -MmArmInitSystem(IN ULONG Phase, - IN PLOADER_PARAMETER_BLOCK LoaderBlock) +INIT_FUNCTION +MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { // // Always return success for now // DPRINT1("NEVER TELL ME THE ODDS!\n"); while (TRUE); - return TRUE; + return STATUS_SUCCESS; } /* EOF */ diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index 07e2224dc3d..cfa99d77330 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -130,12 +130,12 @@ C_ASSERT(SYSTEM_PD_SIZE == PAGE_SIZE); // // Access Flags // -#define PTE_READONLY 0 +#define PTE_READONLY 0 // Doesn't exist on x86 #define PTE_EXECUTE 0 // Not worrying about NX yet #define PTE_EXECUTE_READ 0 // Not worrying about NX yet #define PTE_READWRITE 0x2 #define PTE_WRITECOPY 0x200 -#define PTE_EXECUTE_READWRITE 0x0 +#define PTE_EXECUTE_READWRITE 0x2 // Not worrying about NX yet #define PTE_EXECUTE_WRITECOPY 0x200 #define PTE_PROTOTYPE 0x400 // @@ -145,6 +145,20 @@ C_ASSERT(SYSTEM_PD_SIZE == PAGE_SIZE); #define PTE_DISABLE_CACHE 0x10 #define PTE_WRITECOMBINED_CACHE 0x10 #elif defined(_M_ARM) +#define PTE_READONLY 0x200 +#define PTE_EXECUTE 0 // Not worrying about NX yet +#define PTE_EXECUTE_READ 0 // Not worrying about NX yet +#define PTE_READWRITE 0 // Doesn't exist on ARM +#define PTE_WRITECOPY 0 // Doesn't exist on ARM +#define PTE_EXECUTE_READWRITE 0 // Not worrying about NX yet +#define PTE_EXECUTE_WRITECOPY 0 // Not worrying about NX yet +#define PTE_PROTOTYPE 0x400 // Using the Shared bit +// +// Cache flags +// +#define PTE_ENABLE_CACHE 0 +#define PTE_DISABLE_CACHE 0x10 +#define PTE_WRITECOMBINED_CACHE 0x10 #else #error Define these please! #endif @@ -179,7 +193,7 @@ extern const ULONG MmProtectToValue[32]; #ifdef _M_IX86 #define MM_PTE_SOFTWARE_PROTECTION_BITS 5 #elif _M_ARM -#define MM_PTE_SOFTWARE_PROTECTION_BITS 5 +#define MM_PTE_SOFTWARE_PROTECTION_BITS 6 #elif _M_AMD64 #define MM_PTE_SOFTWARE_PROTECTION_BITS 5 #else diff --git a/reactos/ntoskrnl/mm/arm/page.c b/reactos/ntoskrnl/mm/arm/page.c index c24115a049d..549b65a9613 100644 --- a/reactos/ntoskrnl/mm/arm/page.c +++ b/reactos/ntoskrnl/mm/arm/page.c @@ -12,10 +12,111 @@ #define NDEBUG #include +#line 15 "ARM³::ARMPAGE" +#define MODULE_INVOLVED_IN_ARM3 +#include "../ARM3/miarm.h" + /* GLOBALS ********************************************************************/ +const +ULONG +MmProtectToPteMask[32] = +{ + // + // These are the base MM_ protection flags + // + 0, + PTE_READONLY | PTE_ENABLE_CACHE, + PTE_EXECUTE | PTE_ENABLE_CACHE, + PTE_EXECUTE_READ | PTE_ENABLE_CACHE, + PTE_READWRITE | PTE_ENABLE_CACHE, + PTE_WRITECOPY | PTE_ENABLE_CACHE, + PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE, + PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE, + // + // These OR in the MM_NOCACHE flag + // + 0, + PTE_READONLY | PTE_DISABLE_CACHE, + PTE_EXECUTE | PTE_DISABLE_CACHE, + PTE_EXECUTE_READ | PTE_DISABLE_CACHE, + PTE_READWRITE | PTE_DISABLE_CACHE, + PTE_WRITECOPY | PTE_DISABLE_CACHE, + PTE_EXECUTE_READWRITE | PTE_DISABLE_CACHE, + PTE_EXECUTE_WRITECOPY | PTE_DISABLE_CACHE, + // + // These OR in the MM_DECOMMIT flag, which doesn't seem supported on x86/64/ARM + // + 0, + PTE_READONLY | PTE_ENABLE_CACHE, + PTE_EXECUTE | PTE_ENABLE_CACHE, + PTE_EXECUTE_READ | PTE_ENABLE_CACHE, + PTE_READWRITE | PTE_ENABLE_CACHE, + PTE_WRITECOPY | PTE_ENABLE_CACHE, + PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE, + PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE, + // + // These OR in the MM_NOACCESS flag, which seems to enable WriteCombining? + // + 0, + PTE_READONLY | PTE_WRITECOMBINED_CACHE, + PTE_EXECUTE | PTE_WRITECOMBINED_CACHE, + PTE_EXECUTE_READ | PTE_WRITECOMBINED_CACHE, + PTE_READWRITE | PTE_WRITECOMBINED_CACHE, + PTE_WRITECOPY | PTE_WRITECOMBINED_CACHE, + PTE_EXECUTE_READWRITE | PTE_WRITECOMBINED_CACHE, + PTE_EXECUTE_WRITECOPY | PTE_WRITECOMBINED_CACHE, +}; + +const +ULONG MmProtectToValue[32] = +{ + PAGE_NOACCESS, + PAGE_READONLY, + PAGE_EXECUTE, + PAGE_EXECUTE_READ, + PAGE_READWRITE, + PAGE_WRITECOPY, + PAGE_EXECUTE_READWRITE, + PAGE_EXECUTE_WRITECOPY, + PAGE_NOACCESS, + PAGE_NOCACHE | PAGE_READONLY, + PAGE_NOCACHE | PAGE_EXECUTE, + PAGE_NOCACHE | PAGE_EXECUTE_READ, + PAGE_NOCACHE | PAGE_READWRITE, + PAGE_NOCACHE | PAGE_WRITECOPY, + PAGE_NOCACHE | PAGE_EXECUTE_READWRITE, + PAGE_NOCACHE | PAGE_EXECUTE_WRITECOPY, + PAGE_NOACCESS, + PAGE_GUARD | PAGE_READONLY, + PAGE_GUARD | PAGE_EXECUTE, + PAGE_GUARD | PAGE_EXECUTE_READ, + PAGE_GUARD | PAGE_READWRITE, + PAGE_GUARD | PAGE_WRITECOPY, + PAGE_GUARD | PAGE_EXECUTE_READWRITE, + PAGE_GUARD | PAGE_EXECUTE_WRITECOPY, + PAGE_NOACCESS, + PAGE_WRITECOMBINE | PAGE_READONLY, + PAGE_WRITECOMBINE | PAGE_EXECUTE, + PAGE_WRITECOMBINE | PAGE_EXECUTE_READ, + PAGE_WRITECOMBINE | PAGE_READWRITE, + PAGE_WRITECOMBINE | PAGE_WRITECOPY, + PAGE_WRITECOMBINE | PAGE_EXECUTE_READWRITE, + PAGE_WRITECOMBINE | PAGE_EXECUTE_WRITECOPY +}; + ULONG MmGlobalKernelPageDirectory[4096]; -MMPDE HyperTemplatePde; + +/* Template PTE and PDE for a kernel page */ +MMPDE ValidKernelPde = {.u.Hard.Valid = 1}; +MMPTE ValidKernelPte = {.u.Hard.Valid = 1, .u.Hard.Sbo = 1}; + +/* Template PDE for a demand-zero page */ +MMPDE DemandZeroPde = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS)}; +MMPTE DemandZeroPte = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS)}; + +/* Template PTE for prototype page */ +MMPTE PrototypePte = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS) | PTE_PROTOTYPE | (MI_PTE_LOOKUP_NEEDED << PAGE_SHIFT)}; /* PRIVATE FUNCTIONS **********************************************************/ @@ -49,25 +150,6 @@ MmUpdatePageDir(IN PEPROCESS Process, return; } -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(IN PEPROCESS Process) -{ - UNIMPLEMENTED; - while (TRUE); - return 0; -} - -NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PULONG DirectoryTableBase) -{ - UNIMPLEMENTED; - while (TRUE); - return STATUS_SUCCESS; -} - PULONG NTAPI MmGetPageDirectory(VOID) @@ -246,16 +328,7 @@ MmInitGlobalKernelPageDirectory(VOID) { ULONG i; PULONG CurrentPageDirectory = (PULONG)PDE_BASE; - extern MMPTE HyperTemplatePte; - - /* Setup PTE template */ - HyperTemplatePte.u.Long = 0; - HyperTemplatePte.u.Hard.Valid = 1; - HyperTemplatePte.u.Hard.Access = 1; - /* Setup PDE template */ - HyperTemplatePde.u.Long = 0; - HyperTemplatePde.u.Hard.Valid = 1; /* Loop the 2GB of address space which belong to the kernel */ for (i = MiGetPdeOffset(MmSystemRangeStart); i < 2048; i++) diff --git a/reactos/ntoskrnl/mm/arm/stubs.c b/reactos/ntoskrnl/mm/arm/stubs.c index 55178c747aa..781ea284e05 100644 --- a/reactos/ntoskrnl/mm/arm/stubs.c +++ b/reactos/ntoskrnl/mm/arm/stubs.c @@ -367,18 +367,6 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, return TRUE; } -VOID -NTAPI -MmUpdatePageDir(IN PEPROCESS Process, - IN PVOID Address, - IN ULONG Size) -{ - // - // Nothing to do - // - return; -} - NTSTATUS NTAPI Mmi386ReleaseMmInfo(IN PEPROCESS Process) @@ -391,30 +379,6 @@ Mmi386ReleaseMmInfo(IN PEPROCESS Process) return 0; } -NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PULONG DirectoryTableBase) -{ - // - // Share the directory base with the idle process - // - DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0]; - DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1]; - - // - // Initialize the Addresss Space - // - KeInitializeGuardedMutex(&Process->AddressCreationLock); - Process->VadRoot.BalancedRoot.u1.Parent = NULL; - - // - // The process now has an address space - // - Process->HasAddressSpace = TRUE; - return STATUS_SUCCESS; -} - PULONG NTAPI MmGetPageDirectory(VOID) diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index 359a035f294..42a0bb854db 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.c @@ -9,6 +9,7 @@ /* INCLUDES ******************************************************************/ +#include "initguid.h" #include #define NDEBUG #include From ae6d759f4c266d300b6ce700c6af1dafadd46b11 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 17:49:52 +0000 Subject: [PATCH 108/132] [NTOS]: Some more ARM build and linker fixes, moving some of the new x86 C code into ARM. This should really be shared later. [NTOS]: Totally broke thread context switching on ARM for now. It's a Good Thing. svn path=/trunk/; revision=49781 --- reactos/ntoskrnl/ke/arm/cpu.c | 9 ++ reactos/ntoskrnl/ke/arm/ctxswtch.s | 20 +++ reactos/ntoskrnl/ke/arm/thrdini.c | 230 +++++++++++++++++++++++++++++ reactos/ntoskrnl/ntoskrnl.pspec | 2 +- 4 files changed, 260 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/arm/cpu.c b/reactos/ntoskrnl/ke/arm/cpu.c index 275df6c3854..37d8a1569fd 100644 --- a/reactos/ntoskrnl/ke/arm/cpu.c +++ b/reactos/ntoskrnl/ke/arm/cpu.c @@ -57,6 +57,15 @@ KeFlushCurrentTb(VOID) KeFlushTb(); } +VOID +FASTCALL +KeZeroPages(IN PVOID Address, + IN ULONG Size) +{ + /* Not using XMMI in this routine */ + RtlZeroMemory(Address, Size); +} + VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState) diff --git a/reactos/ntoskrnl/ke/arm/ctxswtch.s b/reactos/ntoskrnl/ke/arm/ctxswtch.s index a8f391f8ec3..0d6bb54f27c 100644 --- a/reactos/ntoskrnl/ke/arm/ctxswtch.s +++ b/reactos/ntoskrnl/ke/arm/ctxswtch.s @@ -13,6 +13,10 @@ TEXTAREA NESTED_ENTRY KiSwapContext PROLOG_END KiSwapContext + + // BUSTEDDDD + b . + // // a1 = Old Thread // a2 = New Thread @@ -104,3 +108,19 @@ b . ENTRY_END KiThreadStartup + + NESTED_ENTRY KiSwitchThreads + PROLOG_END KiSwitchThreads + + // BUSTEDDDD + b . + + ENTRY_END KiSwitchThreads + + NESTED_ENTRY KiSwapContextInternal + PROLOG_END KiSwapContextInternal + + // BUSTEDDDD + b . + + ENTRY_END KiSwapContextInternal diff --git a/reactos/ntoskrnl/ke/arm/thrdini.c b/reactos/ntoskrnl/ke/arm/thrdini.c index 16700f54470..cae9b75deb1 100644 --- a/reactos/ntoskrnl/ke/arm/thrdini.c +++ b/reactos/ntoskrnl/ke/arm/thrdini.c @@ -14,6 +14,13 @@ /* GLOBALS ********************************************************************/ +typedef struct _KSWITCHFRAME +{ + PVOID ExceptionList; + BOOLEAN ApcBypassDisable; + PVOID RetAddr; +} KSWITCHFRAME, *PKSWITCHFRAME; + typedef struct _KUINIT_FRAME { KEXCEPTION_FRAME CtxSwitchFrame; @@ -32,6 +39,15 @@ VOID NTAPI KiThreadStartup(VOID); +VOID +FASTCALL +KiSwitchThreads( + IN PKTHREAD OldThread, + IN PKTHREAD NewThread +); + + +/* FIXME: THIS IS TOTALLY BUSTED NOW */ VOID NTAPI KiInitializeContextThread(IN PKTHREAD Thread, @@ -131,3 +147,217 @@ KiInitializeContextThread(IN PKTHREAD Thread, // Thread->KernelStack = (PVOID)CtxSwitchFrame; } + +VOID +FASTCALL +KiIdleLoop(VOID) +{ + PKPRCB Prcb = KeGetCurrentPrcb(); + PKTHREAD OldThread, NewThread; + + /* Initialize the idle loop: disable interrupts */ + _enable(); + YieldProcessor(); + YieldProcessor(); + _disable(); + + /* Now loop forever */ + while (TRUE) + { + /* Check for pending timers, pending DPCs, or pending ready threads */ + if ((Prcb->DpcData[0].DpcQueueDepth) || + (Prcb->TimerRequest) || + (Prcb->DeferredReadyListHead.Next)) + { + /* Quiesce the DPC software interrupt */ + HalClearSoftwareInterrupt(DISPATCH_LEVEL); + + /* Handle it */ + KiRetireDpcList(Prcb); + } + + /* Check if a new thread is scheduled for execution */ + if (Prcb->NextThread) + { + /* Enable interupts */ + _enable(); + + /* Capture current thread data */ + OldThread = Prcb->CurrentThread; + NewThread = Prcb->NextThread; + + /* Set new thread data */ + Prcb->NextThread = NULL; + Prcb->CurrentThread = NewThread; + + /* The thread is now running */ + NewThread->State = Running; + + /* Switch away from the idle thread */ + KiSwapContext(APC_LEVEL, OldThread); + + /* We are back in the idle thread -- disable interrupts again */ + _enable(); + YieldProcessor(); + YieldProcessor(); + _disable(); + } + else + { + /* Continue staying idle. Note the HAL returns with interrupts on */ + Prcb->PowerState.IdleFunction(&Prcb->PowerState); + } + } +} + +BOOLEAN +FASTCALL +KiSwapContextExit(IN PKTHREAD OldThread, + IN PKSWITCHFRAME SwitchFrame) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPROCESS OldProcess, NewProcess; + PKTHREAD NewThread; + ARM_TTB_REGISTER TtbRegister; + + /* We are on the new thread stack now */ + NewThread = Pcr->PrcbData.CurrentThread; + + /* Now we are the new thread. Check if it's in a new process */ + OldProcess = OldThread->ApcState.Process; + NewProcess = NewThread->ApcState.Process; + if (OldProcess != NewProcess) + { + TtbRegister.AsUlong = NewProcess->DirectoryTableBase[0]; + ASSERT(TtbRegister.Reserved == 0); + KeArmTranslationTableRegisterSet(TtbRegister); + } + + /* Increase thread context switches */ + NewThread->ContextSwitches++; + + /* Load data from switch frame */ + Pcr->NtTib.ExceptionList = SwitchFrame->ExceptionList; + + /* DPCs shouldn't be active */ + if (Pcr->PrcbData.DpcRoutineActive) + { + /* Crash the machine */ + KeBugCheckEx(ATTEMPTED_SWITCH_FROM_DPC, + (ULONG_PTR)OldThread, + (ULONG_PTR)NewThread, + (ULONG_PTR)OldThread->InitialStack, + 0); + } + + /* Kernel APCs may be pending */ + if (NewThread->ApcState.KernelApcPending) + { + /* Are APCs enabled? */ + if (!NewThread->SpecialApcDisable) + { + /* Request APC delivery */ + if (SwitchFrame->ApcBypassDisable) HalRequestSoftwareInterrupt(APC_LEVEL); + return TRUE; + } + } + + /* Return */ + return FALSE; +} + +VOID +FASTCALL +KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, + IN ULONG_PTR OldThreadAndApcFlag) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKTHREAD OldThread, NewThread; + + /* Save APC bypass disable */ + SwitchFrame->ApcBypassDisable = OldThreadAndApcFlag & 3; + SwitchFrame->ExceptionList = Pcr->NtTib.ExceptionList; + + /* Increase context switch count and check if tracing is enabled */ + Pcr->ContextSwitches++; + if (Pcr->PerfGlobalGroupMask) + { + /* We don't support this yet on x86 either */ + DPRINT1("WMI Tracing not supported\n"); + ASSERT(FALSE); + } + + /* Get thread pointers */ + OldThread = (PKTHREAD)(OldThreadAndApcFlag & ~3); + NewThread = Pcr->PrcbData.CurrentThread; + + /* Get the old thread and set its kernel stack */ + OldThread->KernelStack = SwitchFrame; + + /* Do the switch */ + KiSwitchThreads(OldThread, NewThread->KernelStack); +} + +VOID +NTAPI +KiDispatchInterrupt(VOID) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPRCB Prcb = &Pcr->PrcbData; + PVOID OldHandler; + PKTHREAD NewThread, OldThread; + + /* Disable interrupts */ + _disable(); + + /* Check for pending timers, pending DPCs, or pending ready threads */ + if ((Prcb->DpcData[0].DpcQueueDepth) || + (Prcb->TimerRequest) || + (Prcb->DeferredReadyListHead.Next)) + { + /* Switch to safe execution context */ + OldHandler = Pcr->NtTib.ExceptionList; + Pcr->NtTib.ExceptionList = EXCEPTION_CHAIN_END; + + /* Retire DPCs while under the DPC stack */ + //KiRetireDpcListInDpcStack(Prcb, Prcb->DpcStack); + // FIXME!!! // + KiRetireDpcList(Prcb); + + /* Restore context */ + Pcr->NtTib.ExceptionList = OldHandler; + } + + /* Re-enable interrupts */ + _enable(); + + /* Check for quantum end */ + if (Prcb->QuantumEnd) + { + /* Handle quantum end */ + Prcb->QuantumEnd = FALSE; + KiQuantumEnd(); + } + else if (Prcb->NextThread) + { + /* Capture current thread data */ + OldThread = Prcb->CurrentThread; + NewThread = Prcb->NextThread; + + /* Set new thread data */ + Prcb->NextThread = NULL; + Prcb->CurrentThread = NewThread; + + /* The thread is now running */ + NewThread->State = Running; + OldThread->WaitReason = WrDispatchInt; + + /* Make the old thread ready */ + KxQueueReadyThread(OldThread, Prcb); + + /* Swap to the new thread */ + KiSwapContext(APC_LEVEL, OldThread); + } +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ntoskrnl.pspec b/reactos/ntoskrnl/ntoskrnl.pspec index 12a4139acfb..1c65cc24145 100644 --- a/reactos/ntoskrnl/ntoskrnl.pspec +++ b/reactos/ntoskrnl/ntoskrnl.pspec @@ -112,7 +112,7 @@ @ FASTCALL ExInterlockedAddLargeStatistic(ptr long) #endif @ stdcall ExInterlockedAddUlong(ptr long ptr) -#ifndef __x86_64__ +#ifdef __x86__ @ FASTCALL ExInterlockedCompareExchange64(ptr ptr ptr ptr) @ stdcall ExInterlockedDecrementLong(ptr ptr) @ stdcall ExInterlockedExchangeUlong(ptr long ptr) From 889287242f08c856a3df46302b6a9d77dd8d985b Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 18:19:42 +0000 Subject: [PATCH 109/132] [NTOS]: Fix 16-bit interlocked operations on ARM (GCC doesn't provide built-ins). ARM should build now. svn path=/trunk/; revision=49782 --- reactos/include/crt/mingw32/intrin_arm.h | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/reactos/include/crt/mingw32/intrin_arm.h b/reactos/include/crt/mingw32/intrin_arm.h index 12ced3ebb4b..f5a07b381fb 100644 --- a/reactos/include/crt/mingw32/intrin_arm.h +++ b/reactos/include/crt/mingw32/intrin_arm.h @@ -67,12 +67,40 @@ __INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destinat __INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand) { - return __sync_val_compare_and_swap(Destination, Comperand, Exchange); + short a, b; + + __asm__ __volatile__ ( "0:\n\t" + "ldr %1, [%2]\n\t" + "cmp %1, %4\n\t" + "bne 1f\n\t" + "swp %0, %3, [%2]\n\t" + "cmp %0, %1\n\t" + "swpne %3, %0, [%2]\n\t" + "bne 0b\n\t" + "1:" + : "=&r" (a), "=&r" (b) + : "r" (Destination), "r" (Exchange), "r" (Comperand) + : "cc", "memory"); + + return a; } -__INTRIN_INLINE long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value) +__INTRIN_INLINE short _InterlockedExchangeAdd16(volatile short * const Addend, const short Value) { - return __sync_fetch_and_add(Addend, Value); + short a, b, c; + + __asm__ __volatile__ ( "0:\n\t" + "ldr %0, [%3]\n\t" + "add %1, %0, %4\n\t" + "swp %2, %1, [%3]\n\t" + "cmp %0, %2\n\t" + "swpne %1, %2, [%3]\n\t" + "bne 0b" + : "=&r" (a), "=&r" (b), "=&r" (c) + : "r" (Value), "r" (Addend) + : "cc", "memory"); + + return a; } __INTRIN_INLINE long _InterlockedCompareExchange(volatile long * const dest, const long exch, const long comp) From ec2d741f31864e9f90969828ad7a107f2ca0f3ad Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 24 Nov 2010 18:30:12 +0000 Subject: [PATCH 110/132] [SERVICES] Fix a typo (|| instead of |). Found by clang. svn path=/trunk/; revision=49783 --- reactos/base/system/services/rpcserver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c index 30df18d071f..cc45ff5f1e4 100644 --- a/reactos/base/system/services/rpcserver.c +++ b/reactos/base/system/services/rpcserver.c @@ -834,8 +834,8 @@ DWORD RQueryServiceObjectSecurity( return ERROR_INVALID_HANDLE; } - if (dwSecurityInformation & (DACL_SECURITY_INFORMATION || - GROUP_SECURITY_INFORMATION || + if (dwSecurityInformation & (DACL_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION)) DesiredAccess |= READ_CONTROL; From a5dbee0b8f18425ff739bafc0efa89ee35e37ad8 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 18:53:47 +0000 Subject: [PATCH 111/132] [NTOS]: STATUS_SUCCESS is not the only succesful return code. svn path=/trunk/; revision=49785 --- reactos/ntoskrnl/ke/arm/trapc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/arm/trapc.c b/reactos/ntoskrnl/ke/arm/trapc.c index d2ff8c426e4..9f731bb578b 100644 --- a/reactos/ntoskrnl/ke/arm/trapc.c +++ b/reactos/ntoskrnl/ke/arm/trapc.c @@ -529,7 +529,7 @@ KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame) Address, KiGetPreviousMode(TrapFrame), TrapFrame); - if (Status == STATUS_SUCCESS) return Status; + if (NT_SUCCESS(Status)) return Status; } // From 5f47e1ddd0ee29547985abb268e8d0ee2ca0df18 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 24 Nov 2010 18:56:35 +0000 Subject: [PATCH 112/132] [NTOS]: Seems like cpsr_c doesn't work in this case? Need to investigate. Put an infinite loop in the entrypoint on ARM. svn path=/trunk/; revision=49786 --- reactos/ntoskrnl/ke/arm/boot.s | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/arm/boot.s b/reactos/ntoskrnl/ke/arm/boot.s index eff065cacbc..5bce7356a16 100644 --- a/reactos/ntoskrnl/ke/arm/boot.s +++ b/reactos/ntoskrnl/ke/arm/boot.s @@ -15,7 +15,10 @@ PROLOG_END KiSystemStartup /* Put us in FIQ mode, set IRQ stack */ - msr cpsr_c, #CPSR_FIQ_MODE + b . + mrs r3, cpsr + orr r3, r1, #CPSR_FIQ_MODE + msr cpsr, r3 ldr sp, [a1, #LpbInterruptStack] /* Repeat for IRQ mode */ From cea642beb383f1c2c4de3da4474b47513d55813e Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Wed, 24 Nov 2010 20:55:15 +0000 Subject: [PATCH 113/132] [FREELDR] poor little printf causes boot break, nuff said. svn path=/trunk/; revision=49789 --- reactos/boot/freeldr/freeldr/windows/winldr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/windows/winldr.c b/reactos/boot/freeldr/freeldr/windows/winldr.c index 073a00a6b5f..95ac954005f 100644 --- a/reactos/boot/freeldr/freeldr/windows/winldr.c +++ b/reactos/boot/freeldr/freeldr/windows/winldr.c @@ -624,7 +624,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName, /* Save final value of LoaderPagesSpanned */ LoaderBlockVA->Extension->LoaderPagesSpanned = LoaderPagesSpanned; - printf( "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n", + DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n", KiSystemStartup, LoaderBlockVA); WinLdrpDumpMemoryDescriptors(LoaderBlockVA); From fb04d4fd236caf06cf6d055dff6b57f1264eea61 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 24 Nov 2010 22:51:03 +0000 Subject: [PATCH 114/132] [NTOSKRNL] Fix the fix, ie fix x86. Everything should work now ~ svn path=/trunk/; revision=49790 --- reactos/ntoskrnl/include/internal/i386/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/include/internal/i386/mm.h b/reactos/ntoskrnl/include/internal/i386/mm.h index 2f70fd5e2f3..83b48efef56 100644 --- a/reactos/ntoskrnl/include/internal/i386/mm.h +++ b/reactos/ntoskrnl/include/internal/i386/mm.h @@ -39,7 +39,7 @@ PULONG MmGetPageDirectory(VOID); // Convert a PTE into a corresponding address // #define MiPteToAddress(PTE) ((PVOID)((ULONG)(PTE) << 10)) -#define MiPdeToAddress(PDE) ((PVOID)((ULONG)(PDE) << 18)) +#define MiPdeToAddress(PDE) ((PVOID)((ULONG)(PDE) << 10)) #define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (1024 * PAGE_SIZE)) #define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (1024 * PAGE_SIZE))) From cc202fdc318d0cc3df2a4d359c2972bab3250b9f Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 25 Nov 2010 22:03:56 +0000 Subject: [PATCH 115/132] [FREELDR] - Conditionally enable heap-related debugging and validation checks by an MM_DBG define for all architectures. Inspired by 49744. svn path=/trunk/; revision=49792 --- reactos/boot/freeldr/freeldr/rtl/bget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/rtl/bget.c b/reactos/boot/freeldr/freeldr/rtl/bget.c index 60f0dcae93e..fb6c2d49d34 100644 --- a/reactos/boot/freeldr/freeldr/rtl/bget.c +++ b/reactos/boot/freeldr/freeldr/rtl/bget.c @@ -407,7 +407,7 @@ all buffers allocated are a multiple of this size. This MUST be a power of two. */ -#ifndef _M_ARM +#ifdef MM_DBG #define BufDump 1 /* Define this symbol to enable the bpoold() function which dumps the From ff164c8fa4f5c46870d17588cca6eb40b2b5b29a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 27 Nov 2010 19:02:37 +0000 Subject: [PATCH 116/132] [XML] Silence a warning on MSVC svn path=/trunk/; revision=49824 --- reactos/tools/xml.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/tools/xml.cpp b/reactos/tools/xml.cpp index 8400ce131ed..50125e129d6 100644 --- a/reactos/tools/xml.cpp +++ b/reactos/tools/xml.cpp @@ -18,6 +18,7 @@ #ifdef _MSC_VER #pragma warning ( disable : 4786 ) +#pragma warning ( disable : 4996 ) #endif//_MSC_VER #ifdef WIN32 @@ -41,7 +42,6 @@ #include #include #include "xml.h" -#include "ssprintf.h" #ifndef MAX_PATH #define MAX_PATH _MAX_PATH @@ -100,7 +100,9 @@ XMLException::XMLException ( void XMLException::SetExceptionV ( const std::string& location, const char* format, va_list args ) { - _e = location + ": " + ssvprintf(format,args); + char buffer[1024]; + _vsnprintf(buffer, sizeof(buffer)-1, format, args); + _e = location + ": " + buffer; } void XMLException::SetException ( const std::string& location, const char* format, ... ) @@ -424,13 +426,14 @@ string XMLFile::Location() const { int line = 1; + char line_str[10]; const char* p = strchr ( _buf.c_str(), '\n' ); while ( p && p < _p ) { ++line; p = strchr ( p+1, '\n' ); } - return ssprintf ( "%s(%i)",_filename.c_str(), line ); + return _filename + "(" + itoa(line, line_str, 10) + ")"; } XMLAttribute::XMLAttribute() From 9ce593995947c6815715a297d4df0a8feed59d6d Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 27 Nov 2010 21:38:11 +0000 Subject: [PATCH 117/132] [MPRAPI] - Sync to Wine-1.3.8 See issue #5718 for more details. svn path=/trunk/; revision=49825 --- reactos/dll/win32/mprapi/mprapi.c | 26 ++++++++++++++++++++++++++ reactos/dll/win32/mprapi/mprapi.spec | 2 +- reactos/media/doc/README.WINE | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/mprapi/mprapi.c b/reactos/dll/win32/mprapi/mprapi.c index 90f47ae0c6b..715f1b8cada 100644 --- a/reactos/dll/win32/mprapi/mprapi.c +++ b/reactos/dll/win32/mprapi/mprapi.c @@ -44,6 +44,32 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) return TRUE; } +/*********************************************************************** + * MprAdminGetErrorString (MPRAPI.@) + * + * Return a unicode string for the given mpr errorcode + * + * PARAMS + * mprerror [i] errorcode, for which a description is requested + * localstr [o] pointer, where a buffer with the error description is returned + * + * RETURNS + * Failure: ERROR_MR_MID_NOT_FOUND, when mprerror is not known + * Success: ERROR_SUCCESS, and in localstr a pointer to a buffer from LocalAlloc, + * which contains the error description. + * + * NOTES + * The caller must free the returned buffer with LocalFree + * + */ +DWORD APIENTRY MprAdminGetErrorString(DWORD mprerror, LPWSTR *localstr) +{ + FIXME("(0x%x/%u, %p): stub!\n", mprerror, mprerror, localstr); + + *localstr = NULL; + return ERROR_MR_MID_NOT_FOUND; +} + /*********************************************************************** * MprAdminIsServiceRunning (MPRAPI.@) */ diff --git a/reactos/dll/win32/mprapi/mprapi.spec b/reactos/dll/win32/mprapi/mprapi.spec index 6fb84393f2d..4b5937b8806 100644 --- a/reactos/dll/win32/mprapi/mprapi.spec +++ b/reactos/dll/win32/mprapi/mprapi.spec @@ -6,7 +6,7 @@ @ stub MprAdminDeregisterConnectionNotification @ stub MprAdminDeviceEnum @ stub MprAdminEstablishDomainRasServer -@ stub MprAdminGetErrorString +@ stdcall MprAdminGetErrorString(long ptr) @ stub MprAdminGetPDCServer @ stub MprAdminInterfaceConnect @ stub MprAdminInterfaceCreate diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 0937d63e64b..adaff2f0e71 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -90,6 +90,7 @@ reactos/dll/win32/mciseq # Autosync reactos/dll/win32/mciwave # Autosync reactos/dll/win32/mlang # Autosync reactos/dll/win32/mpr # Autosync +reactos/dll/win32/mprapi # Autosync reactos/dll/win32/msacm32 # Autosync reactos/dll/win32/msadp32.acm # Autosync reactos/dll/win32/mscat32 # Autosync From 1d70b8136abd6c1805bffa90cd182ec57e7a0fa2 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 27 Nov 2010 22:12:15 +0000 Subject: [PATCH 118/132] [ASM] Merge asm related changes from cmake branch. svn path=/trunk/; revision=49826 --- .../boot/freeldr/freeldr/arch/amd64/arch.S | 9 +- .../boot/freeldr/freeldr/arch/amd64/boot.S | 10 +- .../boot/freeldr/freeldr/arch/amd64/i386pnp.S | 4 + .../boot/freeldr/freeldr/arch/amd64/int386.S | 5 + reactos/boot/freeldr/freeldr/arch/amd64/mb.S | 5 + reactos/boot/freeldr/freeldr/arch/i386/arch.S | 370 +++---- reactos/dll/ntdll/dispatch/i386/dispatch.S | 70 +- .../dll/win32/kernel32/thread/amd64/fiber.S | 8 +- .../dll/win32/kernel32/thread/amd64/thread.S | 9 +- .../dll/win32/kernel32/thread/i386/fiber.S | 16 +- .../dll/win32/kernel32/thread/i386/thread.S | 13 +- reactos/hal/halx86/amd64/mps.S | 7 +- reactos/hal/halx86/amd64/systimer.S | 6 +- reactos/hal/halx86/generic/i386/systimer.S | 224 +++-- reactos/hal/halx86/generic/i386/trap.S | 10 +- reactos/include/reactos/asm.inc | 262 +++++ reactos/include/reactos/ks386.inc | 946 ++++++++++++++++++ reactos/lib/rtl/amd64/debug_asm.S | 2 +- reactos/lib/rtl/amd64/except_asm.S | 4 +- reactos/lib/rtl/amd64/rtlmem.S | 3 +- reactos/lib/rtl/amd64/slist.S | 4 +- reactos/lib/rtl/i386/debug_asm.S | 36 +- reactos/lib/rtl/i386/except_asm.s | 90 +- reactos/lib/rtl/i386/interlck.S | 37 +- reactos/lib/rtl/i386/res_asm.s | 19 +- reactos/lib/rtl/i386/rtlmem.s | 47 +- reactos/lib/sdk/crt/except/amd64/chkstk_asm.s | 6 +- reactos/lib/sdk/crt/except/amd64/seh.s | 6 +- reactos/lib/sdk/crt/except/i386/chkstk_asm.s | 99 +- reactos/lib/sdk/crt/except/i386/prolog.s | 27 +- reactos/lib/sdk/crt/except/i386/seh.s | 41 +- reactos/lib/sdk/crt/float/i386/logb.c | 2 +- reactos/lib/sdk/crt/math/amd64/alldiv.S | 3 +- reactos/lib/sdk/crt/math/amd64/atan.S | 4 +- reactos/lib/sdk/crt/math/amd64/atan2.S | 4 +- reactos/lib/sdk/crt/math/amd64/ceil.S | 4 +- reactos/lib/sdk/crt/math/amd64/ceilf.S | 32 +- reactos/lib/sdk/crt/math/amd64/exp.S | 5 +- reactos/lib/sdk/crt/math/amd64/fabs.S | 3 +- reactos/lib/sdk/crt/math/amd64/floor.S | 6 +- reactos/lib/sdk/crt/math/amd64/floorf.S | 25 +- reactos/lib/sdk/crt/math/amd64/fmod.S | 5 +- reactos/lib/sdk/crt/math/amd64/fmodf.S | 5 +- reactos/lib/sdk/crt/math/amd64/ldexp.S | 5 +- reactos/lib/sdk/crt/math/amd64/log.S | 3 +- reactos/lib/sdk/crt/math/amd64/log10.S | 3 +- reactos/lib/sdk/crt/math/amd64/pow.S | 4 +- reactos/lib/sdk/crt/math/amd64/sqrt.S | 6 +- reactos/lib/sdk/crt/math/amd64/sqrtf.S | 6 +- reactos/lib/sdk/crt/math/amd64/tan.S | 6 +- reactos/lib/sdk/crt/math/i386/alldiv_asm.s | 18 +- reactos/lib/sdk/crt/math/i386/alldvrm_asm.s | 51 +- reactos/lib/sdk/crt/math/i386/allmul_asm.s | 8 +- reactos/lib/sdk/crt/math/i386/allrem_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/allshl_asm.s | 9 +- reactos/lib/sdk/crt/math/i386/allshr_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/atan2_asm.s | 18 + reactos/lib/sdk/crt/math/i386/atan_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/aulldiv_asm.s | 33 +- reactos/lib/sdk/crt/math/i386/aulldvrm_asm.s | 35 +- reactos/lib/sdk/crt/math/i386/aullrem_asm.s | 35 +- reactos/lib/sdk/crt/math/i386/aullshr_asm.s | 19 +- reactos/lib/sdk/crt/math/i386/ceil_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/ceilf.S | 53 +- reactos/lib/sdk/crt/math/i386/cos_asm.s | 9 +- reactos/lib/sdk/crt/math/i386/exp_asm.s | 29 + reactos/lib/sdk/crt/math/i386/fabs_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/floor_asm.s | 13 +- reactos/lib/sdk/crt/math/i386/floorf.S | 57 +- reactos/lib/sdk/crt/math/i386/fmod_asm.s | 26 + reactos/lib/sdk/crt/math/i386/fmodf_asm.s | 26 + reactos/lib/sdk/crt/math/i386/ftol2_asm.s | 28 + reactos/lib/sdk/crt/math/i386/ftol_asm.s | 13 +- reactos/lib/sdk/crt/math/i386/log10_asm.s | 8 +- reactos/lib/sdk/crt/math/i386/log_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/pow_asm.s | 373 +++---- reactos/lib/sdk/crt/math/i386/sin_asm.s | 9 +- reactos/lib/sdk/crt/math/i386/sqrt_asm.s | 11 +- reactos/lib/sdk/crt/math/i386/tan_asm.s | 11 +- reactos/lib/sdk/crt/mem/i386/memchr_asm.s | 34 +- reactos/lib/sdk/crt/mem/i386/memcpy_asm.s | 114 --- reactos/lib/sdk/crt/mem/i386/memmove_asm.s | 158 +-- reactos/lib/sdk/crt/mem/i386/memset_asm.s | 65 +- reactos/lib/sdk/crt/setjmp/amd64/setjmp.s | 6 +- reactos/lib/sdk/crt/setjmp/i386/setjmp.s | 71 +- reactos/lib/sdk/crt/string/i386/strcat_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strchr_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strcmp_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strcpy_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strlen_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strncat_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strncmp_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strncpy_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strnlen_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/strrchr_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/tchar.h | 8 +- reactos/lib/sdk/crt/string/i386/tcscat.h | 32 - reactos/lib/sdk/crt/string/i386/tcscat.inc | 35 + reactos/lib/sdk/crt/string/i386/tcschr.h | 30 - reactos/lib/sdk/crt/string/i386/tcschr.inc | 32 + reactos/lib/sdk/crt/string/i386/tcscmp.h | 34 - reactos/lib/sdk/crt/string/i386/tcscmp.inc | 37 + reactos/lib/sdk/crt/string/i386/tcscpy.h | 27 - reactos/lib/sdk/crt/string/i386/tcscpy.inc | 30 + reactos/lib/sdk/crt/string/i386/tcslen.h | 29 - reactos/lib/sdk/crt/string/i386/tcslen.inc | 32 + reactos/lib/sdk/crt/string/i386/tcsncat.h | 42 - reactos/lib/sdk/crt/string/i386/tcsncat.inc | 45 + reactos/lib/sdk/crt/string/i386/tcsncmp.h | 40 - reactos/lib/sdk/crt/string/i386/tcsncmp.inc | 43 + reactos/lib/sdk/crt/string/i386/tcsncpy.h | 34 - reactos/lib/sdk/crt/string/i386/tcsncpy.inc | 37 + reactos/lib/sdk/crt/string/i386/tcsnlen.h | 30 - reactos/lib/sdk/crt/string/i386/tcsnlen.inc | 33 + reactos/lib/sdk/crt/string/i386/tcsrchr.h | 31 - reactos/lib/sdk/crt/string/i386/tcsrchr.inc | 34 + reactos/lib/sdk/crt/string/i386/wcscat_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcschr_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcscmp_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcscpy_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcslen_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcsncat_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcsncmp_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcsncpy_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcsnlen_asm.s | 2 +- reactos/lib/sdk/crt/string/i386/wcsrchr_asm.s | 2 +- reactos/ntoskrnl/ex/i386/fastinterlck_asm.S | 104 +- reactos/ntoskrnl/ex/i386/interlck_asm.S | 54 +- reactos/ntoskrnl/ex/i386/ioport.S | 66 +- .../ntoskrnl/include/internal/i386/asmmacro.S | 14 +- reactos/ntoskrnl/kdbg/amd64/kdb_help.S | 12 +- reactos/ntoskrnl/kdbg/i386/kdb_help.S | 187 ++-- reactos/ntoskrnl/ke/amd64/boot.S | 8 +- reactos/ntoskrnl/ke/amd64/ctxswitch.S | 5 +- reactos/ntoskrnl/ke/amd64/trap.S | 5 +- reactos/ntoskrnl/ke/i386/ctxswitch.S | 39 +- reactos/ntoskrnl/ke/i386/trap.s | 30 +- reactos/ntoskrnl/ke/i386/usercall_asm.S | 38 +- reactos/ntoskrnl/rtl/i386/stack.S | 11 +- .../win32/win32k/dib/i386/dib24bpp_hline.s | 13 +- .../win32k/dib/i386/dib32bpp_colorfill.s | 17 +- .../win32/win32k/dib/i386/dib32bpp_hline.s | 11 +- .../win32/win32k/eng/i386/floatobj.S | 72 +- .../win32/win32k/misc/i386/atan2_asm.s | 10 +- .../win32/win32k/misc/i386/ceil_asm.s | 10 +- .../win32/win32k/misc/i386/cos_asm.s | 8 +- .../win32/win32k/misc/i386/floor_asm.s | 12 +- .../win32/win32k/misc/i386/sin_asm.s | 8 +- reactos/tools/nci/ncitool.c | 102 +- 149 files changed, 3474 insertions(+), 2029 deletions(-) create mode 100644 reactos/include/reactos/asm.inc create mode 100644 reactos/include/reactos/ks386.inc create mode 100644 reactos/lib/sdk/crt/math/i386/atan2_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/exp_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/fmod_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/fmodf_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/ftol2_asm.s delete mode 100644 reactos/lib/sdk/crt/string/i386/tcscat.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcscat.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcschr.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcschr.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcscmp.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcscmp.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcscpy.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcscpy.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcslen.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcslen.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcsncat.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcsncat.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcsncmp.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcsncmp.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcsncpy.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcsncpy.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcsnlen.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcsnlen.inc delete mode 100644 reactos/lib/sdk/crt/string/i386/tcsrchr.h create mode 100644 reactos/lib/sdk/crt/string/i386/tcsrchr.inc diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S index 9def109221c..236a0be4b69 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S @@ -1,10 +1,13 @@ -.intel_syntax noprefix -.text -.code16 #define ASM + +#include + #include +.text +.code16 + //.org 0x8000 .global RealEntryPoint diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/boot.S b/reactos/boot/freeldr/freeldr/arch/amd64/boot.S index eb3ba3c3c64..bc2e43e9e8b 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/boot.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/boot.S @@ -17,14 +17,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + + .text .code16 #define ASM #include - -EXTERN(ChainLoadBiosBootSectorCode) +PUBLIC ChainLoadBiosBootSectorCode +ChainLoadBiosBootSectorCode: .code64 call x86_64_SwitchToReal @@ -46,7 +49,8 @@ EXTERN(ChainLoadBiosBootSectorCode) // ljmpl $0x0000,$0x7C00 jmp 0x7c00:0x0000 -EXTERN(SoftReboot) +PUBLIC SoftReboot +SoftReboot: .code64 call x86_64_SwitchToReal diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S b/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S index 19589275bac..c74fb97d64d 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + + .text .code16 @@ -255,4 +258,5 @@ EXTERN(PnpBiosGetDeviceNode) ret +END /* EOF */ diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/int386.S b/reactos/boot/freeldr/freeldr/arch/amd64/int386.S index a22e409c61c..6881173910d 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/int386.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/int386.S @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + + .intel_syntax noprefix .text .code16 @@ -168,3 +171,5 @@ Int386_vector_opcode: mov eax, Int386_eax ret + +END diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/mb.S b/reactos/boot/freeldr/freeldr/arch/amd64/mb.S index 2d515e90053..51b06bc1e01 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/mb.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/mb.S @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + + .text .code16 @@ -61,3 +64,5 @@ pd_startup: .fill 4096, 1, 0 PageDirectoryEnd: + +END diff --git a/reactos/boot/freeldr/freeldr/arch/i386/arch.S b/reactos/boot/freeldr/freeldr/arch/i386/arch.S index 9e9475eecda..225dc4be3f9 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/arch.S @@ -17,27 +17,29 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - .text - .code16 +.intel_syntax noprefix +#define HEX(y) 0x##y #define ASM #include #include + .code16 EXTERN(RealEntryPoint) cli /* Setup segment registers */ - xorw %ax,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + /* Setup a stack */ - movw stack16,%sp + mov sp, word ptr ds:stack16 sti @@ -47,24 +49,24 @@ EXTERN(RealEntryPoint) .code32 /* Zero BootDrive and BootPartition */ - xorl %eax,%eax - movl %eax,(_BootDrive) - movl %eax,(_BootPartition) + xor eax, eax + mov dword ptr [_BootDrive], eax + mov dword ptr [_BootPartition], eax /* Store the boot drive */ - movb %dl,(_BootDrive) + mov byte ptr [_BootDrive], dl /* Store the boot partition */ - movb %dh,(_BootPartition) + mov byte ptr [_BootPartition], dh /* GO! */ - pushl %eax + push eax call _BootMain call switch_to_real .code16 - int $0x19 + int HEX(19) /* We should never get here */ stop: @@ -78,7 +80,7 @@ stop: */ EXTERN(switch_to_prot) - .code16 +.code16 cli /* None of these */ @@ -88,18 +90,18 @@ EXTERN(switch_to_prot) /* Of course CS has to already be valid. */ /* We are currently in real-mode so we */ /* need real-mode segment values. */ - xorw %ax,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax /* Get the return address off the stack */ - popw (code32ret) + pop word ptr ds:[code32ret] /* Save 16-bit stack pointer */ - movw %sp,stack16 + mov word ptr ds:[stack16], sp /* Load the GDT */ lgdt gdtptr @@ -107,28 +109,28 @@ EXTERN(switch_to_prot) lidt i386idtptr /* Enable Protected Mode */ - mov %cr0,%eax - orl $CR0_PE_SET,%eax - mov %eax,%cr0 + mov eax, cr0 + or eax, CR0_PE_SET + mov cr0, eax /* Clear prefetch queue & correct CS */ - ljmp $PMODE_CS, $inpmode + //ljmp PMODE_CS, inpmode + jmp far ptr PMODE_CS:inpmode - - .code32 +.code32 inpmode: /* Setup segment selectors */ - movw $PMODE_DS,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss - movl stack32,%esp + mov ax, PMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + mov esp, dword ptr [stack32] /* Put the return address back onto the stack */ - pushl (code32ret) + push dword ptr [code32ret] /* Now return in p-mode! */ ret @@ -139,7 +141,7 @@ inpmode: */ EXTERN(switch_to_real) - .code32 +.code32 /* We don't know what values are currently */ /* in the segment registers. So we are */ @@ -147,48 +149,49 @@ EXTERN(switch_to_real) /* Of course CS has to already be valid. */ /* We are currently in protected-mode so we */ /* need protected-mode segment values. */ - movw $PMODE_DS,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss + mov ax, PMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax /* Get the return address off the stack */ - popl (code16ret) + pop dword ptr [code16ret] /* Save 32-bit stack pointer */ - movl %esp,stack32 + mov dword ptr [stack32], esp /* jmp to 16-bit segment to set the limit correctly */ - ljmp $RMODE_CS, $switch_to_real16 + ljmp RMODE_CS, switch_to_real16 switch_to_real16: - .code16 +.code16 /* Restore segment registers to correct limit */ - movw $RMODE_DS,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss + mov ax, RMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax /* Disable Protected Mode */ - mov %cr0,%eax - andl $CR0_PE_CLR,%eax - mov %eax,%cr0 + mov eax, cr0 + and eax, CR0_PE_CLR + mov cr0, eax /* Clear prefetch queue & correct CS */ - ljmp $0, $inrmode + //ljmp $0, $inrmode + jmp far ptr 0:inrmode inrmode: - movw %cs,%ax - movw %ax,%ds - movw %ax,%es - movw %ax,%fs - movw %ax,%gs - movw %ax,%ss + mov ax, cs + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax /* Clear out the high 16-bits of ESP */ /* This is needed because I have one */ @@ -196,12 +199,12 @@ inrmode: /* anything other than 0x0000 is in the high */ /* 16-bits of ESP. Even though real-mode */ /* code should only use SP and not ESP. */ - xorl %esp,%esp + xor esp, esp - movw stack16,%sp + mov sp, word ptr ds:[stack16] /* Put the return address back onto the stack */ - pushw (code16ret) + push word ptr ds:[code16ret] /* Load IDTR with real mode value */ lidt rmode_idtptr @@ -215,14 +218,14 @@ inrmode: /* * Needed for enabling the a20 address line */ - .code16 +.code16 empty_8042: .word 0x00eb,0x00eb // jmp $+2, jmp $+2 - inb $0x64,%al - cmp $0xff, %al // legacy-free machine without keyboard - jz empty_8042_ret // controllers on Intel Macs read back 0xFF - testb $0x02,%al - jnz empty_8042 + in al, HEX(64) + cmp al, HEX(ff) // legacy-free machine without keyboard + jz empty_8042_ret // controllers on Intel Macs read back 0xFF + test al, 2 + jnz empty_8042 empty_8042_ret: ret @@ -230,24 +233,24 @@ empty_8042_ret: * Enable the A20 address line (to allow access to over 1mb) */ EXTERN(_EnableA20) +.code32 + + pusha + + call switch_to_real +.code16 + + call empty_8042 + mov al, HEX(D1) // command write + out HEX(64), al + call empty_8042 + mov al, HEX(DF) // A20 on + out HEX(60), al + call empty_8042 + call switch_to_prot .code32 - pushal - - call switch_to_real - .code16 - - call empty_8042 - movb $0xD1,%al // command write - outb %al,$0x64 - call empty_8042 - mov $0xDF,%al // A20 on - out %al,$0x60 - call empty_8042 - call switch_to_prot - .code32 - - popal + popa ret @@ -255,24 +258,24 @@ EXTERN(_EnableA20) * Disable the A20 address line */ EXTERN(_DisableA20) - .code32 +.code32 - pushal + pusha - call switch_to_real + call switch_to_real .code16 call empty_8042 - movb $0xD1,%al // command write - outb %al,$0x64 - call empty_8042 - mov $0xDD,%al // A20 off - out %al,$0x60 + mov al, HEX(D1) // command write + out HEX(64), al + call empty_8042 + mov al, HEX(DD) // A20 off + out HEX(60), al call empty_8042 call switch_to_prot .code32 - popal + popa ret @@ -294,11 +297,11 @@ EXTERN(_DisableA20) * above 1MB. So we let Grub load us there and then relocate * ourself to 0x8000 */ -#define FREELDR_BASE 0x8000 -#define INITIAL_BASE 0x200000 +#define FREELDR_BASE HEX(8000) +#define INITIAL_BASE HEX(200000) /* Align 32 bits boundary */ - .align 4 +.align 4 /* Multiboot header */ MultibootHeader: @@ -330,44 +333,45 @@ MultibootEntry: * our own */ lgdt gdtptrhigh + INITIAL_BASE - FREELDR_BASE /* Reload segment selectors */ - ljmp $PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE) + //ljmp $PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE) + jmp far ptr PMODE_CS: (mb1 + INITIAL_BASE - FREELDR_BASE) mb1: - movw $PMODE_DS,%dx - movw %dx,%ds - movw %dx,%es + mov dx, PMODE_DS + mov ds, dx + mov es, dx /* Check for valid multiboot signature */ - cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax - jne mbfail + cmp eax, MULTIBOOT_BOOTLOADER_MAGIC + jne mbfail /* Store multiboot info in a safe place */ - movl %ebx,%esi - movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi - movl $MB_INFO_SIZE,%ecx + mov esi, ebx + mov edi, offset mb_info + INITIAL_BASE - FREELDR_BASE + mov ecx, MB_INFO_SIZE rep movsb /* Save commandline */ - movl MB_INFO_FLAGS_OFFSET(%ebx),%edx - testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx) - jz mb3 - movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi - movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi - movl $CMDLINE_SIZE,%ecx + mov edx, [ebx + MB_INFO_FLAGS_OFFSET] + test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE + jz mb3 + mov esi, [ebx + MB_INFO_COMMAND_LINE_OFFSET] + mov edi, offset cmdline + INITIAL_BASE - FREELDR_BASE + mov ecx, CMDLINE_SIZE mb2: lodsb stosb - testb %al,%al - jz mb3 - dec %ecx - jnz mb2 + test al, al + jz mb3 + dec ecx + jnz mb2 mb3: /* Copy to low mem */ - movl $INITIAL_BASE,%esi - movl $FREELDR_BASE,%edi - movl $(__bss_end__ - FREELDR_BASE),%ecx - addl $3,%ecx - shrl $2,%ecx - rep movsl + mov esi, INITIAL_BASE + mov edi, FREELDR_BASE + mov ecx, (offset __bss_end__ - FREELDR_BASE) + add ecx, 3 + shr ecx, 2 + rep movsd /* Load the GDT and IDT */ lgdt gdtptr @@ -375,47 +379,49 @@ mb3: /* Clear prefetch queue & correct CS, * jump to low mem */ - ljmp $PMODE_CS, $mb4 + //ljmp $PMODE_CS, $mb4 + jmp far ptr PMODE_CS:mb4 mb4: /* Reload segment selectors */ - movw $PMODE_DS,%dx - movw %dx,%ds - movw %dx,%es - movw %dx,%fs - movw %dx,%gs - movw %dx,%ss - movl $STACK32ADDR,%esp + mov dx, PMODE_DS + mov ds, dx + mov es, dx + mov fs, dx + mov gs, dx + mov ss, dx + mov esp, STACK32ADDR - movl $mb_info,%ebx + mov ebx, offset mb_info /* See if the boot device was passed in */ - movl MB_INFO_FLAGS_OFFSET(%ebx),%edx - testl $MB_INFO_FLAG_BOOT_DEVICE,%edx - jz mb5 + mov edx, [ebx + MB_INFO_FLAGS_OFFSET] + test edx, MB_INFO_FLAG_BOOT_DEVICE + jz mb5 /* Retrieve boot device info */ - movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax - shrl $16,%eax - incb %al - movb %al,_BootPartition - movb %ah,_BootDrive - jmp mb6 + mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET] + shr eax, 16 + inc al + mov byte ptr _BootPartition, al + mov byte ptr _BootDrive, ah + jmp mb6 mb5: /* No boot device known, assume first partition of first harddisk */ - movb $0x80,_BootDrive - movb $1,_BootPartition + mov byte ptr _BootDrive, HEX(80) + mov byte ptr _BootPartition, 1 mb6: /* Check for command line */ - mov $cmdline,%eax - testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx) - jnz mb7 - xorl %eax,%eax + mov eax, offset cmdline + test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE + jnz mb7 + xor eax, eax mb7: /* GO! */ - pushl %eax + push eax call _BootMain -mbfail: call switch_to_real +mbfail: + call switch_to_real .code16 - int $0x19 + int 0x19 mbstop: jmp mbstop /* We should never get here */ .code32 @@ -437,52 +443,52 @@ code32ret: .long 0 - .p2align 2 /* force 4-byte alignment */ + .align 4 /* force 4-byte alignment */ gdt: /* NULL Descriptor */ - .word 0x0000 - .word 0x0000 - .word 0x0000 - .word 0x0000 + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) /* 32-bit flat CS */ - .word 0xFFFF - .word 0x0000 - .word 0x9A00 - .word 0x00CF + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9A00) + .word HEX(00CF) /* 32-bit flat DS */ - .word 0xFFFF - .word 0x0000 - .word 0x9200 - .word 0x00CF + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(00CF) /* 16-bit real mode CS */ - .word 0xFFFF - .word 0x0000 - .word 0x9E00 - .word 0x0000 + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9E00) + .word HEX(0000) /* 16-bit real mode DS */ - .word 0xFFFF - .word 0x0000 - .word 0x9200 - .word 0x0000 + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(0000) /* GDT table pointer */ gdtptr: - .word 0x27 /* Limit */ - .long gdt /* Base Address */ + .word HEX(27) /* Limit */ + .long gdt /* Base Address */ /* Initial GDT table pointer for multiboot */ gdtptrhigh: - .word 0x27 /* Limit */ - .long gdt + INITIAL_BASE - FREELDR_BASE /* Base Address */ + .word HEX(27) /* Limit */ + .long gdt + INITIAL_BASE - FREELDR_BASE /* Base Address */ /* Real-mode IDT pointer */ rmode_idtptr: - .word 0x3ff /* Limit */ - .long 0 /* Base Address */ + .word HEX(3ff) /* Limit */ + .long 0 /* Base Address */ mb_info: .fill MB_INFO_SIZE, 1, 0 diff --git a/reactos/dll/ntdll/dispatch/i386/dispatch.S b/reactos/dll/ntdll/dispatch/i386/dispatch.S index c17374e9ed1..25f7c34bcee 100644 --- a/reactos/dll/ntdll/dispatch/i386/dispatch.S +++ b/reactos/dll/ntdll/dispatch/i386/dispatch.S @@ -8,13 +8,22 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include + +EXTERN _LdrpInit@12:PROC +EXTERN _NtTestAlert@0:PROC +EXTERN _RtlDispatchException@8:PROC +EXTERN _RtlRaiseException@4:PROC +EXTERN _RtlRaiseStatus@4:PROC +EXTERN _ZwCallbackReturn@12:PROC +EXTERN _ZwContinue@8:PROC +EXTERN _ZwRaiseException@12:PROC /* FUNCTIONS ****************************************************************/ +.code -.func LdrInitializeThunk@16 -.globl _LdrInitializeThunk@16 +PUBLIC _LdrInitializeThunk@16 _LdrInitializeThunk@16: /* Get the APC Context */ @@ -28,9 +37,8 @@ _LdrInitializeThunk@16: /* Jump into the C initialization routine */ jmp _LdrpInit@12 -.endfunc -.func KiUserApcExceptionHandler + _KiUserApcExceptionHandler: /* Put the exception record in ECX and check the Flags */ @@ -45,10 +53,9 @@ _KiUserApcExceptionHandler: /* We'll execute handler */ mov eax, EXCEPTION_EXECUTE_HANDLER ret 16 -.endfunc -.func KiUserApcDispatcher@16 -.globl _KiUserApcDispatcher@16 + +PUBLIC _KiUserApcDispatcher@16 _KiUserApcDispatcher@16: /* Setup SEH stack */ @@ -86,9 +93,8 @@ StatusRaiseApc: call _RtlRaiseStatus@4 jmp StatusRaiseApc ret 16 -.endfunc -.func KiUserCallbackExceptionHandler + _KiUserCallbackExceptionHandler: /* Put the exception record in ECX and check the Flags */ @@ -106,10 +112,9 @@ return: /* We'll execute the handler */ mov eax, EXCEPTION_EXECUTE_HANDLER ret 16 -.endfunc -.func KiUserCallbackDispatcher@12 -.globl _KiUserCallbackDispatcher@12 + +PUBLIC _KiUserCallbackDispatcher@12 _KiUserCallbackDispatcher@12: /* Setup SEH stack */ @@ -131,7 +136,7 @@ _KiUserCallbackDispatcher@12: mov eax, [eax+PEB_KERNEL_CALLBACK_TABLE] /* Call the routine */ - call [eax+edx*4] + call dword ptr [eax+edx*4] /* Return from callback */ push eax @@ -148,10 +153,9 @@ StatusRaise: call _RtlRaiseStatus@4 jmp StatusRaise ret 12 -.endfunc -.func KiRaiseUserExceptionDispatcher@0 -.globl _KiRaiseUserExceptionDispatcher@0 + +PUBLIC _KiRaiseUserExceptionDispatcher@0 _KiRaiseUserExceptionDispatcher@0: /* Setup stack for EXCEPTION_RECORD */ @@ -177,10 +181,9 @@ _KiRaiseUserExceptionDispatcher@0: mov esp, ebp pop ebp ret -.endfunc -.func KiUserExceptionDispatcher@8 -.globl _KiUserExceptionDispatcher@8 + +PUBLIC _KiUserExceptionDispatcher@8 _KiUserExceptionDispatcher@8: /* Clear direction flag */ @@ -236,39 +239,35 @@ Exit: push esp call _RtlRaiseException@4 ret 8 -.endfunc -.func KiIntSystemCall@0 -.globl _KiIntSystemCall@0 + +PUBLIC _KiIntSystemCall@0 _KiIntSystemCall@0: /* Set stack in EDX and do the interrupt */ lea edx, [esp+8] - int 0x2E + int HEX(2E) /* Return to caller */ ret -.endfunc -.func KiFastSystemCall@0 -.globl _KiFastSystemCall@0 + +PUBLIC _KiFastSystemCall@0 _KiFastSystemCall@0: /* Put ESP in EDX and do the SYSENTER */ mov edx, esp sysenter -.endfunc -.func KiFastSystemCallRet@0 -.globl _KiFastSystemCallRet@0 + +PUBLIC _KiFastSystemCallRet@0 _KiFastSystemCallRet@0: /* Just return to caller */ ret -.endfunc -.func RtlpGetStackLimits@8 -.globl _RtlpGetStackLimits@8 + +PUBLIC _RtlpGetStackLimits@8 _RtlpGetStackLimits@8: /* Get the stack limits */ @@ -283,4 +282,5 @@ _RtlpGetStackLimits@8: /* return */ ret 8 -.endfunc + +END diff --git a/reactos/dll/win32/kernel32/thread/amd64/fiber.S b/reactos/dll/win32/kernel32/thread/amd64/fiber.S index 984447abe11..09ea635d23c 100644 --- a/reactos/dll/win32/kernel32/thread/amd64/fiber.S +++ b/reactos/dll/win32/kernel32/thread/amd64/fiber.S @@ -7,11 +7,13 @@ * KJK::Hyperion */ -#include +#include -.globl SwitchToFiber -.intel_syntax noprefix + +PUBLIC SwitchToFiber SwitchToFiber: /* FIXME: TODO */ ret 4 + +END diff --git a/reactos/dll/win32/kernel32/thread/amd64/thread.S b/reactos/dll/win32/kernel32/thread/amd64/thread.S index 2c0c2260cb8..71ed562f816 100644 --- a/reactos/dll/win32/kernel32/thread/amd64/thread.S +++ b/reactos/dll/win32/kernel32/thread/amd64/thread.S @@ -6,9 +6,11 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -.globl BaseThreadStartupThunk -.globl BaseProcessStartThunk -.intel_syntax noprefix +#include + + +PUBLIC BaseThreadStartupThunk +PUBLIC BaseProcessStartThunk BaseThreadStartupThunk: @@ -29,4 +31,5 @@ BaseProcessStartThunk: push 0 /* Return RIP */ jmp BaseProcessStartup +END /* EOF */ diff --git a/reactos/dll/win32/kernel32/thread/i386/fiber.S b/reactos/dll/win32/kernel32/thread/i386/fiber.S index 57358ffeed4..bf88c468487 100644 --- a/reactos/dll/win32/kernel32/thread/i386/fiber.S +++ b/reactos/dll/win32/kernel32/thread/i386/fiber.S @@ -7,11 +7,12 @@ * KJK::Hyperion */ -#include +#include +#include -.globl _SwitchToFiber@4 -.intel_syntax noprefix +.code +PUBLIC _SwitchToFiber@4 _SwitchToFiber@4: /* Get the TEB */ mov edx, fs:[TEB_SELF] @@ -30,7 +31,7 @@ _SwitchToFiber@4: mov [eax+FIBER_CONTEXT_EIP], ebx /* Check if we're to save FPU State */ - cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT + cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT jnz NoFpuStateSave /* Save the FPU State (Status and Control)*/ @@ -80,7 +81,7 @@ NoFpuStateSave: mov [edx+TEB_ACTIVATION_CONTEXT_STACK_POINTER], esi /* Restore FPU State */ - cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT + cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT jnz NoFpuStateRestore /* Check if the Status Word Changed */ @@ -96,7 +97,7 @@ NoFpuStateSave: StatusWordChanged: /* Load the new one */ - mov word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD], 0xFFFF + mov word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD], HEX(0FFFF) fldenv [ecx+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] ControlWordEqual: @@ -120,6 +121,7 @@ NoFpuStateRestore: mov [edx+TEB_FLS_DATA], eax /* Jump to new fiber */ - jmp [ecx+FIBER_CONTEXT_EIP] + jmp dword ptr [ecx+FIBER_CONTEXT_EIP] +END /* EOF */ diff --git a/reactos/dll/win32/kernel32/thread/i386/thread.S b/reactos/dll/win32/kernel32/thread/i386/thread.S index 5dea1ee7400..a07bcb2e60e 100644 --- a/reactos/dll/win32/kernel32/thread/i386/thread.S +++ b/reactos/dll/win32/kernel32/thread/i386/thread.S @@ -6,9 +6,15 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -.globl _BaseThreadStartupThunk@0 -.globl _BaseProcessStartThunk@0 -.intel_syntax noprefix +#include + +.code + +EXTERN _BaseThreadStartup@8:PROC +EXTERN _BaseProcessStartup@4:PROC + +PUBLIC _BaseThreadStartupThunk@0 +PUBLIC _BaseProcessStartThunk@0 _BaseThreadStartupThunk@0: @@ -29,4 +35,5 @@ _BaseProcessStartThunk@0: push 0 /* Return EIP */ jmp _BaseProcessStartup@4 +END /* EOF */ diff --git a/reactos/hal/halx86/amd64/mps.S b/reactos/hal/halx86/amd64/mps.S index 35436520ae6..7a3b8c55aa6 100644 --- a/reactos/hal/halx86/amd64/mps.S +++ b/reactos/hal/halx86/amd64/mps.S @@ -8,8 +8,9 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include /* FUNCTIONS *****************************************************************/ @@ -92,5 +93,5 @@ MpsTimerInterrupt: AFTER iret - +END /* EOF */ diff --git a/reactos/hal/halx86/amd64/systimer.S b/reactos/hal/halx86/amd64/systimer.S index 1cb3b6e02a3..47d2a844b23 100644 --- a/reactos/hal/halx86/amd64/systimer.S +++ b/reactos/hal/halx86/amd64/systimer.S @@ -7,8 +7,9 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include /* GLOBALS *******************************************************************/ @@ -90,3 +91,4 @@ HalpClockInterrupt: UNIMPLEMENTED _HalpClockInterrupt iret +END diff --git a/reactos/hal/halx86/generic/i386/systimer.S b/reactos/hal/halx86/generic/i386/systimer.S index 1a5bb45a1b8..8534f88a204 100644 --- a/reactos/hal/halx86/generic/i386/systimer.S +++ b/reactos/hal/halx86/generic/i386/systimer.S @@ -7,12 +7,42 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include + +#include + +EXTERN _HalpAcquireSystemHardwareSpinLock@0:PROC +EXTERN _HalpReleaseCmosSpinLock@0:PROC +EXTERN _DbgBreakPoint@0:PROC +EXTERN _HalpCurrentRollOver:DWORD +EXTERN _HalpPerfCounterCutoff:DWORD + +#define PIC1_BASE HEX(20) /* IO base address for master PIC */ +#define PIC2_BASE HEX(A0) /* IO base address for slave PIC */ +#define PIC1_COMMAND PIC1_BASE +#define PIC1_DATA (PIC1_BASE+1) +#define PIC2_COMMAND PIC2_BASE +#define PIC2_DATA (PIC2_BASE+1) +#define PIC_EOI HEX(20) +#define PIC_SPECIFIC_EOI2 HEX(62) + +#define CMOS_ADDR HEX(70) +#define CMOS_DATA HEX(71) +#define CMOS_REGISTER_A HEX(0A) +#define CMOS_REGISTER_B HEX(0B) +#define CMOS_REGISTER_C HEX(0C) +#define CMOS_REGISTER_D HEX(0D) + +#define PIT_CH0 HEX(40) +#define PIT_MODE HEX(43) +#define SYSTEM_CTRL_PORT_A HEX(92) /* GLOBALS *******************************************************************/ -.globl _HalpPerfCounter +.data +ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING + +PUBLIC _HalpPerfCounter _HalpLastPerfCounterLow: .long 0 _HalpLastPerfCounterHigh: .long 0 _HalpPerfCounter: @@ -22,8 +52,8 @@ _HalpSystemHardwareFlags: .long 0 /* FUNCTIONS *****************************************************************/ -.global _HalpCalibrateStallExecution@0 -.func HalpCalibrateStallExecution@0 +.code +PUBLIC _HalpCalibrateStallExecution@0 _HalpCalibrateStallExecution@0: /* Setup the stack frame */ @@ -37,27 +67,27 @@ _HalpCalibrateStallExecution@0: /* Get the current interrupt mask on the PICs */ xor eax, eax - in al, 0xA1 + in al, PIC2_DATA shl eax, 8 - in al, 0x21 + in al, PIC1_DATA /* Save it */ push eax /* Now mask everything except the RTC and PIC 2 chain-interrupt */ - mov eax, ~((1 << 2) | (1 << 8)) + mov eax, NOT (HEX(04) OR HEX(100)) /* Program the PICs */ - out 0x21, al + out PIC1_DATA, al shr eax, 8 - out 0xA1, al + out PIC2_DATA, al /* Now get the IDT */ sidt [ebp-8] mov ecx, [ebp-6] /* Get the IDT entry for the RTC */ - mov eax, 0x38 + mov eax, HEX(38) shl eax, 3 add ecx, eax @@ -70,7 +100,7 @@ _HalpCalibrateStallExecution@0: mov eax, offset OnlyOnePersonCanWriteHalCode mov [ecx], ax mov word ptr [ecx+2], KGDT_R0_CODE - mov word ptr [ecx+4], 0x8E00 + mov word ptr [ecx+4], HEX(08E00) shr eax, 16 mov [ecx+6], ax @@ -81,18 +111,18 @@ _HalpCalibrateStallExecution@0: call _HalpAcquireSystemHardwareSpinLock@0 /* Now initialize register A on the CMOS */ - mov ax, (0x2D << 8) | 0xA - out 0x70, al + mov ax, HEX(2D00) OR CMOS_REGISTER_A + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register B */ - mov ax, 0xB - out 0x70, al + mov ax, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Don't touch the LastKnownGoodConfig hack */ @@ -100,28 +130,28 @@ _HalpCalibrateStallExecution@0: mov ah, al /* Enable the interrupt */ - or ah, 0x42 + or ah, HEX(42) /* Now write the register B */ - mov al, 0xB - out 0x70, al + mov al, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register C */ - mov al, 0xC - out 0x70, al + mov al, CMOS_REGISTER_C + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Read register D */ - mov al, 0xD - out 0x70, al + mov al, CMOS_REGISTER_D + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Release CMOS lock */ @@ -169,18 +199,18 @@ OnlyOnePersonCanWriteHalCode: call _HalpAcquireSystemHardwareSpinLock@0 /* Now initialize register A on the CMOS */ - mov ax, (0x2D << 8) | 0xA - out 0x70, al + mov ax, HEX(2D00) OR CMOS_REGISTER_A + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register B */ - mov ax, 0xB - out 0x70, al + mov ax, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Don't touch the LastKnownGoodConfig hack */ @@ -188,38 +218,38 @@ OnlyOnePersonCanWriteHalCode: mov ah, al /* Enable the interrupt */ - or ah, 0x42 + or ah, HEX(42) /* Now write the register B */ - mov al, 0xB - out 0x70, al + mov al, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register C */ - mov al, 0xC - out 0x70, al + mov al, CMOS_REGISTER_C + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Read register D */ - mov al, 0xD - out 0x70, al + mov al, CMOS_REGISTER_D + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Release CMOS lock */ call _HalpReleaseCmosSpinLock@0 /* Dismiss the interrupt */ - mov al, 0x20 - out 0xA0, al - mov al, 0x62 - out 0x20, al + mov al, PIC_EOI + out PIC2_COMMAND, al + mov al, PIC_SPECIFIC_EOI2 + out PIC1_COMMAND, al /* Reset the counter and return back to the looper */ xor eax, eax @@ -248,24 +278,24 @@ FoundFactor: /* Prepare for interrupt return */ pop eax push offset AndItsNotYou - mov eax, 0x13 + mov eax, HEX(13) /* Acquire CMOS lock */ call _HalpAcquireSystemHardwareSpinLock@0 /* Now initialize register A on the CMOS */ - mov ax, (0x2D << 8) | 0xA - out 0x70, al + mov ax, HEX(2D00) OR CMOS_REGISTER_A + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register B */ - mov ax, 0xB - out 0x70, al + mov ax, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Don't touch the LastKnownGoodConfig hack */ @@ -273,34 +303,34 @@ FoundFactor: mov ah, al /* Disable the interrupt */ - or ah, 0x2 + or ah, 2 /* Now write the register B */ - mov al, 0xB - out 0x70, al + mov al, CMOS_REGISTER_B + out CMOS_ADDR, al jmp $+2 mov al, ah - out 0x71, al + out CMOS_DATA, al jmp $+2 /* Read register C */ - mov al, 0xC - out 0x70, al + mov al, CMOS_REGISTER_C + out CMOS_ADDR, al jmp $+2 - in al, 0x71 + in al, CMOS_DATA jmp $+2 /* Release CMOS lock */ call _HalpReleaseCmosSpinLock@0 /* Dismiss the interrupt */ - mov al, 0x20 - out 0xA0, al - mov al, 0x62 - out 0x20, al + mov al, PIC_EOI + out PIC2_COMMAND, al + mov al, PIC_SPECIFIC_EOI2 + out PIC1_COMMAND, al /* Disable interrupts on return */ - and word ptr [esp+8], ~EFLAGS_INTERRUPT_MASK + and word ptr [esp+8], NOT EFLAGS_INTERRUPT_MASK iretd /************************* WE ARE BACK FROM RTC ***************************/ @@ -313,9 +343,9 @@ AndItsNotYou: /* Restore the mask */ pop eax - out 0x21, al + out PIC1_DATA, al shr eax, 8 - out 0xA1, al + out PIC2_DATA, al /* Restore EFLAGS */ popf @@ -324,11 +354,10 @@ AndItsNotYou: mov esp, ebp pop ebp ret -.endfunc + #ifndef _MINIHAL_ -.globl _KeStallExecutionProcessor@4 -.func KeStallExecutionProcessor@4 +PUBLIC _KeStallExecutionProcessor@4 _KeStallExecutionProcessor@4: /* Get the number of microseconds required */ @@ -356,11 +385,9 @@ SubtractLoop: Done: /* Return */ ret 4 -.endfunc #endif -.global _KeQueryPerformanceCounter@4 -.func KeQueryPerformanceCounter@4 +PUBLIC _KeQueryPerformanceCounter@4 _KeQueryPerformanceCounter@4: /* Check if we were called too early */ @@ -380,20 +407,20 @@ LoopPreInt: LoopPostInt: /* Get the current value */ - mov ebx, _HalpPerfCounterLow - mov esi, _HalpPerfCounterHigh + mov ebx, dword ptr _HalpPerfCounterLow + mov esi, dword ptr _HalpPerfCounterHigh /* Read 8254 timer */ - mov al, 0 - out 0x43, al - in al, 0x92 - or al, _HalpPerfCounterCutoff - out 0x92, al + mov al, 0 /* Interrupt on terminal count */ + out PIT_MODE, al + in al, SYSTEM_CTRL_PORT_A + or al, byte ptr _HalpPerfCounterCutoff + out SYSTEM_CTRL_PORT_A, al jmp $+2 - in al, 0x40 + in al, PIT_CH0 jmp $+2 movzx ecx, al - in al, 0x40 + in al, PIT_CH0 mov ch, al /* Enable interrupts and do a short wait */ @@ -406,8 +433,8 @@ LoopPostInt: cli /* Get the counter value again */ - mov eax, _HalpPerfCounterLow - mov edx, _HalpPerfCounterHigh + mov eax, dword ptr _HalpPerfCounterLow + mov edx, dword ptr _HalpPerfCounterHigh /* Check if someone updated the counter */ cmp eax, ebx @@ -417,7 +444,7 @@ LoopPostInt: /* Check if the current 8254 value causes rollover */ neg ecx - add ecx, _HalpCurrentRollOver + add ecx, dword ptr _HalpCurrentRollOver jnb DoRollOver SetSum: @@ -427,19 +454,19 @@ SetSum: adc edx, 0 /* Check if we're above or below the last high value */ - cmp edx, _HalpLastPerfCounterHigh + cmp edx, dword ptr _HalpLastPerfCounterHigh jb short BelowHigh jnz short BelowLow /* Check if we're above or below the last low value */ - cmp eax, _HalpLastPerfCounterLow + cmp eax, dword ptr _HalpLastPerfCounterLow jb BelowHigh BelowLow: /* Update the last value and bring back interrupts */ - mov _HalpLastPerfCounterLow, eax - mov _HalpLastPerfCounterHigh, edx + mov dword ptr _HalpLastPerfCounterLow, eax + mov dword ptr _HalpLastPerfCounterHigh, edx popf /* Check if caller wants frequency */ @@ -469,7 +496,7 @@ DoRollOver: /* We might have an incoming interrupt, save EFLAGS and reset rollover */ mov esi, [esp] - mov ecx, _HalpCurrentRollOver + mov ecx, dword ptr _HalpCurrentRollOver popf /* Check if interrupts were enabled and try again */ @@ -483,8 +510,8 @@ DoRollOver: BelowHigh: /* Get the last counter values */ - mov ebx, _HalpLastPerfCounterLow - mov esi, _HalpLastPerfCounterHigh + mov ebx, dword ptr _HalpLastPerfCounterLow + mov esi, dword ptr _HalpLastPerfCounterHigh /* Check if the previous value was 0 and go back if yes */ mov ecx, ebx @@ -495,7 +522,7 @@ BelowHigh: sub ebx, eax sbb esi, edx jnz InvalidCount - cmp ebx, _HalpCurrentRollOver + cmp ebx, dword ptr _HalpCurrentRollOver jg InvalidCount /* Fixup the count with the last known value */ @@ -517,7 +544,8 @@ BelowHigh: InvalidCount: popf xor eax, eax - mov _HalpLastPerfCounterLow, eax - mov _HalpLastPerfCounterHigh, eax + mov dword ptr _HalpLastPerfCounterLow, eax + mov dword ptr _HalpLastPerfCounterHigh, eax jmp LoopPreInt -.endfunc + +END diff --git a/reactos/hal/halx86/generic/i386/trap.S b/reactos/hal/halx86/generic/i386/trap.S index 2ad319bfb6e..8a4f4538144 100644 --- a/reactos/hal/halx86/generic/i386/trap.S +++ b/reactos/hal/halx86/generic/i386/trap.S @@ -8,12 +8,12 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include #include -.code32 -.text +.code TRAP_ENTRY HalpTrap0D, 0 TRAP_ENTRY HalpApcInterrupt, KI_SOFTWARE_TRAP @@ -42,4 +42,6 @@ _HalpRealModeStart: .space 2048 _HalpRealModeEnd: PUBLIC _HalpRealModeEnd +.endcode16 +END diff --git a/reactos/include/reactos/asm.inc b/reactos/include/reactos/asm.inc new file mode 100644 index 00000000000..4274221fc19 --- /dev/null +++ b/reactos/include/reactos/asm.inc @@ -0,0 +1,262 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/include/amd64/asmmacro.S + * PURPOSE: ASM macros for for GAS and MASM/ML64 + * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#ifdef _USE_ML + +/* Allow ".name" identifiers */ +OPTION DOTNAME + +.686P +.XMM +.MODEL FLAT +ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING + +/* Hex numbers need to be in 01ABh format */ +#define HEX(x) 0##x##h + +/* Macro values need to be marked */ +#define VAL(x) x + +/* MASM/ML doesn't want explicit [rip] addressing */ +rip = 0 + +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(name, ...) name MACRO __VA_ARGS__ + +/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ +.PROC MACRO name + name PROC FRAME + _name: +ENDM + +/* ... and .ENDP, replacing ENDP */ +.ENDP MACRO name + name ENDP +ENDM + +/* MASM doesn't have an ASCII macro */ +.ASCII MACRO text + DB text +ENDM + +/* MASM doesn't have an ASCIZ macro */ +.ASCIZ MACRO text + DB text, 0 +ENDM + +#define lgdt lgdt fword ptr ds: + +#define lidt lidt fword ptr ds: + +ljmp MACRO segment, offset + DB 0 +ENDM + +.code64 MACRO + .code +ENDM + +.code32 MACRO + .code + .586P +ENDM + +.code16 MACRO + ASSUME nothing + .text SEGMENT use16 +ENDM + +.endcode16 MACRO + .text ENDS +ENDM + +.bss MACRO + .DATA? + ASSUME nothing +ENDM + +//.text MACRO +//ENDM + +.align MACRO alignment + ALIGN alignment +ENDM + +.byte MACRO args:VARARG + db args +ENDM + +.short MACRO args:VARARG + dw args +ENDM + +.word MACRO args:VARARG + dw args +ENDM + +.long MACRO args:VARARG + dd args +ENDM + +.double MACRO args:VARARG + dq args +ENDM + +.org MACRO value + ORG value +ENDM + +.fill MACRO repeat, size, value +// FIXME +ENDM + +ljmp MACRO segment, offset +// FIXME +ENDM + +UNIMPLEMENTED MACRO name +ENDM + +/* We need this to distinguish repeat from macros */ +#define ENDR ENDM + +#else /***********************************************************************/ + +/* Force intel syntax */ +.intel_syntax noprefix + +.altmacro + +/* Hex numbers need to be in 0x1AB format */ +#define HEX(y) 0x##y + +/* Macro values need to be marked */ +#define VAL(x) \x + +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(...) .macro __VA_ARGS__ +#define ENDM .endm + +/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ +.macro .PROC name + .func \name + \name: + .cfi_startproc + .equ cfa_current_offset, -8 +.endm + +/* ... and .ENDP, replacing ENDP */ +.macro .ENDP name + .cfi_endproc + .endfunc +.endm + +/* MASM compatible PUBLIC */ +.macro PUBLIC symbol + .global \symbol +.endm + +/* Dummy ASSUME */ +.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8 +.endm + +/* MASM needs an end tag for segments */ +.macro .endcode16 +.endm + +/* MASM compatible ALIGN */ +#define ALIGN .align + +/* MASM compatible REPEAT, additional ENDR */ +#define REPEAT .rept +#define ENDR .endr + +.macro ljmp segment, offset + jmp far ptr \segment:\offset +.endm + +/* MASM compatible EXTERN */ +.macro EXTERN name +.endm + +/* MASM needs an END tag */ +#define END + +.macro .MODEL model +.endm + +.macro .code + .text +.endm + +/* Macros for x64 stack unwind OPs */ + +.macro .allocstack size + .cfi_adjust_cfa_offset \size + .set cfa_current_offset, cfa_current_offset - \size +.endm + +code = 1 +.macro .pushframe param=0 + .if (\param) + .cfi_adjust_cfa_offset 0x30 + .set cfa_current_offset, cfa_current_offset - 0x30 + .else + .cfi_adjust_cfa_offset 0x28 + .set cfa_current_offset, cfa_current_offset - 0x28 + .endif +.endm + +.macro .pushreg reg + .cfi_adjust_cfa_offset 8 + .equ cfa_current_offset, cfa_current_offset - 8 + .cfi_offset \reg, cfa_current_offset +.endm + +.macro .savereg reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .savexmm128 reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .setframe reg, offset + .cfi_def_cfa reg, \offset + .equ cfa_current_offset, \offset +.endm + +.macro .endprolog +.endm + +.macro UNIMPLEMENTED2 file, line, func + + jmp 3f +1: .asciz "\func" +2: .asciz \file +3: + sub rsp, 0x20 + lea rcx, MsgUnimplemented[rip] + lea rdx, 1b[rip] + lea r8, 2b[rip] + mov r9, \line + call DbgPrint + add rsp, 0x20 +.endm +#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, + +/* MASM/ML uses ".if" for runtime conditionals, and "if" for compile time + conditionals. We therefore use "if", too. .if shouldn't be used at all */ +#define if .if +#define endif .endif +#define else .else +#define elseif .elseif + +#endif diff --git a/reactos/include/reactos/ks386.inc b/reactos/include/reactos/ks386.inc new file mode 100644 index 00000000000..a4272847a9f --- /dev/null +++ b/reactos/include/reactos/ks386.inc @@ -0,0 +1,946 @@ + +/* Pointer size */ +SizeofPointer = 0x4 + +/* Breakpoints */ +BREAKPOINT_BREAK = 0x0 +BREAKPOINT_PRINT = 0x1 +BREAKPOINT_PROMPT = 0x2 +BREAKPOINT_LOAD_SYMBOLS = 0x3 +BREAKPOINT_UNLOAD_SYMBOLS = 0x4 +BREAKPOINT_COMMAND_STRING = 0x5 + +/* Context Frame Flags */ +CONTEXT_FULL = 0x10007 +CONTEXT_CONTROL = 0x10001 +CONTEXT_INTEGER = 0x10002 +CONTEXT_SEGMENTS = 0x10004 +CONTEXT_FLOATING_POINT = 0x10008 +CONTEXT_DEBUG_REGISTERS = 0x10010 + +/* Exception flags */ +EXCEPTION_NONCONTINUABLE = 0x1 +EXCEPTION_UNWINDING = 0x2 +EXCEPTION_EXIT_UNWIND = 0x4 +EXCEPTION_STACK_INVALID = 0x8 +EXCEPTION_NESTED_CALL = 0x10 +EXCEPTION_TARGET_UNWIND = 0x20 +EXCEPTION_COLLIDED_UNWIND = 0x20 +EXCEPTION_UNWIND = 0x6 +EXCEPTION_EXECUTE_HANDLER = 0x1 +EXCEPTION_CONTINUE_SEARCH = 0x0 +EXCEPTION_CONTINUE_EXECUTION = 0xffffffff +EXCEPTION_CHAIN_END = 0xffffffff + +/* Exception types */ +ExceptionContinueExecution = 0x0 +ExceptionContinueSearch = 0x1 +ExceptionNestedException = 0x2 +ExceptionCollidedUnwind = 0x3 + +/* Lock Queue */ +LOCK_QUEUE_WAIT = 0x1 +LOCK_QUEUE_OWNER = 0x2 +LockQueueDispatcherLock = 0x0 + +/* Process states */ +ProcessInMemory = 0x0 +ProcessOutOfMemory = 0x1 +ProcessInTransition = 0x2 + +/* Processor mode */ +KernelMode = 0x0 +UserMode = 0x1 + +/* Status codes */ +STATUS_ACCESS_VIOLATION = 0xc0000005 +STATUS_ASSERTION_FAILURE = 0xc0000420 +STATUS_ARRAY_BOUNDS_EXCEEDED = 0xc000008c +STATUS_BAD_COMPRESSION_BUFFER = 0xc0000242 +STATUS_BREAKPOINT = 0x80000003 +STATUS_CALLBACK_POP_STACK = 0xc0000423 +STATUS_DATATYPE_MISALIGNMENT = 0x80000002 +STATUS_FLOAT_DENORMAL_OPERAND = 0xc000008d +STATUS_FLOAT_DIVIDE_BY_ZERO = 0xc000008e +STATUS_FLOAT_INEXACT_RESULT = 0xc000008f +STATUS_FLOAT_INVALID_OPERATION = 0xc0000090 +STATUS_FLOAT_OVERFLOW = 0xc0000091 +STATUS_FLOAT_STACK_CHECK = 0xc0000092 +STATUS_FLOAT_UNDERFLOW = 0xc0000093 +STATUS_FLOAT_MULTIPLE_FAULTS = 0xc00002b4 +STATUS_FLOAT_MULTIPLE_TRAPS = 0xc00002b5 +STATUS_GUARD_PAGE_VIOLATION = 0x80000001 +STATUS_ILLEGAL_FLOAT_CONTEXT = 0xc000014a +STATUS_ILLEGAL_INSTRUCTION = 0xc000001d +STATUS_INSTRUCTION_MISALIGNMENT = 0xc00000aa +STATUS_INVALID_HANDLE = 0xc0000008 +STATUS_INVALID_LOCK_SEQUENCE = 0xc000001e +STATUS_INVALID_OWNER = 0xc000005a +STATUS_INVALID_PARAMETER = 0xc000000d +STATUS_INVALID_PARAMETER_1 = 0xc00000ef +STATUS_INVALID_SYSTEM_SERVICE = 0xc000001c +STATUS_INTEGER_DIVIDE_BY_ZERO = 0xc0000094 +STATUS_INTEGER_OVERFLOW = 0xc0000095 +STATUS_IN_PAGE_ERROR = 0xc0000006 +STATUS_KERNEL_APC = 0x100 +STATUS_LONGJUMP = 0x80000026 +STATUS_NO_CALLBACK_ACTIVE = 0xc0000258 +STATUS_NO_EVENT_PAIR = 0xc000014e +STATUS_PRIVILEGED_INSTRUCTION = 0xc0000096 +STATUS_SINGLE_STEP = 0x80000004 +STATUS_STACK_BUFFER_OVERRUN = 0xc0000409 +STATUS_STACK_OVERFLOW = 0xc00000fd +STATUS_SUCCESS = 0x0 +STATUS_THREAD_IS_TERMINATING = 0xc000004b +STATUS_TIMEOUT = 0x102 +STATUS_UNWIND = 0xc0000027 +STATUS_UNWIND_CONSOLIDATE = 0x80000029 +STATUS_USER_APC = 0xc0 +STATUS_WAKE_SYSTEM_DEBUGGER = 0x80000007 + +/* TLS defines */ +TLS_MINIMUM_AVAILABLE = 0x40 +TLS_EXPANSION_SLOTS = 0x400 + +/* Thread states */ +Initialized = 0x0 +Ready = 0x1 +Running = 0x2 +Standby = 0x3 +Terminated = 0x4 +Waiting = 0x5 + +/* Wait type / reason */ +WrExecutive = 0x7 +WrMutex = 0x1d +WrDispatchInt = 0x1f +WrQuantumEnd = 0x1e +WrEventPair = 0xe +WaitAny = 0x1 +WaitAll = 0x0 + +/* Interrupt object types */ +InLevelSensitive = 0x0 +InLatched = 0x1 + +/* Bug Check Codes */ +APC_INDEX_MISMATCH = 0x1 +INVALID_AFFINITY_SET = 0x3 +INVALID_DATA_ACCESS_TRAP = 0x4 +IRQL_NOT_GREATER_OR_EQUAL = 0x9 +IRQL_NOT_LESS_OR_EQUAL = 0xa +NO_USER_MODE_CONTEXT = 0xe +SPIN_LOCK_ALREADY_OWNED = 0xf +SPIN_LOCK_NOT_OWNED = 0x10 +THREAD_NOT_MUTEX_OWNER = 0x11 +TRAP_CAUSE_UNKNOWN = 0x12 +KMODE_EXCEPTION_NOT_HANDLED = 0x1e +KERNEL_APC_PENDING_DURING_EXIT = 0x20 +PANIC_STACK_SWITCH = 0x2b +DATA_BUS_ERROR = 0x2e +INSTRUCTION_BUS_ERROR = 0x2f +SYSTEM_EXIT_OWNED_MUTEX = 0x39 +PAGE_FAULT_WITH_INTERRUPTS_OFF = 0x49 +IRQL_GT_ZERO_AT_SYSTEM_SERVICE = 0x4a +DATA_COHERENCY_EXCEPTION = 0x55 +INSTRUCTION_COHERENCY_EXCEPTION = 0x56 +HAL1_INITIALIZATION_FAILED = 0x61 +UNEXPECTED_KERNEL_MODE_TRAP = 0x7f +NMI_HARDWARE_FAILURE = 0x80 +SPIN_LOCK_INIT_FAILURE = 0x81 +ATTEMPTED_SWITCH_FROM_DPC = 0xb8 + +/* IRQL */ +PASSIVE_LEVEL = 0x0 +APC_LEVEL = 0x1 +DISPATCH_LEVEL = 0x2 +CLOCK1_LEVEL = 0x1c +CLOCK2_LEVEL = 0x1c +IPI_LEVEL = 0x1d +POWER_LEVEL = 0x1e +PROFILE_LEVEL = 0x1b +HIGH_LEVEL = 0x1f +#ifdef NT_UP +SYNCH_LEVEL = 0x2 +#else +SYNCH_LEVEL = 0x1b +#endif + +/* Stack sizes */ +KERNEL_STACK_SIZE = 0x3000 +KERNEL_LARGE_STACK_SIZE = 0xf000 +KERNEL_LARGE_STACK_COMMIT = 0x3000 + +/* Miscellaneous Definitions */ +LOW_REALTIME_PRIORITY = 0x10 +CLOCK_QUANTUM_DECREMENT = 0x3 +WAIT_QUANTUM_DECREMENT = 0x1 +MAXIMUM_PROCESSORS = 0x20 +INITIAL_STALL_COUNT = 0x64 +KI_EXCEPTION_ACCESS_VIOLATION = 0x10000004 +Executive = 0x0 +FALSE = 0x0 +TRUE = 0x1 +DBG_STATUS_CONTROL_C = 0x1 +USER_SHARED_DATA = 0x7ffe0000 +PAGE_SIZE = 0x1000 +MAXIMUM_IDTVECTOR = 0xff +PRIMARY_VECTOR_BASE = 0x30 +RPL_MASK = 0x3 +MODE_MASK = 0x1 +NUMBER_SERVICE_TABLES = 0x2 +SERVICE_NUMBER_MASK = 0xfff +SERVICE_TABLE_SHIFT = 0x8 +SERVICE_TABLE_MASK = 0x10 +SERVICE_TABLE_TEST = 0x10 + +/* KAPC */ +ApType = 0x0 +ApSize = 0x2 +ApThread = 0x8 +ApApcListEntry = 0xc +ApKernelRoutine = 0x14 +ApRundownRoutine = 0x18 +ApNormalRoutine = 0x1c +ApNormalContext = 0x20 +ApSystemArgument1 = 0x24 +ApSystemArgument2 = 0x28 +ApApcStateIndex = 0x2c +ApApcMode = 0x2d +ApInserted = 0x2e +ApcObjectLength = 0x30 + +/* KAPC_STATE */ +AsApcListHead = 0x0 +AsProcess = 0x10 +AsKernelApcInProgress = 0x14 +AsKernelApcPending = 0x15 +AsUserApcPending = 0x16 + +/* CLIENT_ID */ +CidUniqueProcess = 0x0 +CidUniqueThread = 0x4 + +/* RTL_CRITICAL_SECTION */ +CsDebugInfo = 0x0 +CsLockCount = 0x4 +CsRecursionCount = 0x8 +CsOwningThread = 0xc +CsLockSemaphore = 0x10 +CsSpinCount = 0x14 + +/* RTL_CRITICAL_SECTION_DEBUG */ +CsType = 0x0 +CsCreatorBackTraceIndex = 0x2 +CsCriticalSection = 0x4 +CsProcessLocksList = 0x8 +CsEntryCount = 0x10 +CsContentionCount = 0x14 + +/* KDEVICE_QUEUE_ENTRY */ +DeDeviceListEntry = 0x0 +DeSortKey = 0x8 +DeInserted = 0xc +DeviceQueueEntryLength = 0x10 + +/* KDPC */ +DpType = 0x0 +DpImportance = 0x1 +DpNumber = 0x2 +DpDpcListEntry = 0x4 +DpDeferredRoutine = 0xc +DpDeferredContext = 0x10 +DpSystemArgument1 = 0x14 +DpSystemArgument2 = 0x18 +DpDpcData = 0x1c +DpcObjectLength = 0x20 + +/* KDEVICE_QUEUE */ +DvType = 0x0 +DvSize = 0x2 +DvDeviceListHead = 0x4 +DvSpinLock = 0xc +DvBusy = 0x10 +DeviceQueueObjectLength = 0x14 + +/* EXCEPTION_RECORD */ +ErExceptionCode = 0x0 +ErExceptionFlags = 0x4 +ErExceptionRecord = 0x8 +ErExceptionAddress = 0xc +ErNumberParameters = 0x10 +ErExceptionInformation = 0x14 +ExceptionRecordLength = 0x50 +EXCEPTION_RECORD_LENGTH = 0x50 + +/* EPROCESS */ +EpDebugPort = 0xcc +EpVdmObjects = 0x144 +ExecutiveProcessObjectLength = 0x278 + +/* KEVENT */ +EvType = 0x0 +EvSize = 0x2 +EvSignalState = 0x4 +EvWaitListHead = 0x8 +EventObjectLength = 0x10 + +/* FAST_MUTEX */ +FmCount = 0x0 +FmOwner = 0x4 +FmContention = 0x8 +FmOldIrql = 0x1c + +/* KINTERRUPT */ +InType = 0x0 +InSize = 0x2 +InInterruptListEntry = 0x4 +InServiceRoutine = 0xc +InServiceContext = 0x10 +InSpinLock = 0x14 +InTickCount = 0x18 +InActualLock = 0x1c +InDispatchAddress = 0x20 +InVector = 0x24 +InIrql = 0x28 +InSynchronizeIrql = 0x29 +InFloatingSave = 0x2a +InConnected = 0x2b +InNumber = 0x2c +InShareVector = 0x2d +InMode = 0x30 +InServiceCount = 0x34 +InDispatchCount = 0x38 +InDispatchCode = 0x3c +InterruptObjectLength = 0x1e4 + +/* IO_STATUS_BLOCK */ +IoStatus = 0x0 +IoPointer = 0x0 +IoInformation = 0x4 + +/* KNODE */ +KnPfnDereferenceSListHead = 0x8 +KnProcessorMask = 0x10 +KnColor = 0x14 +KnSeed = 0x18 +KnNodeNumber = 0x19 +KnFlags = 0x1a +knMmShiftedColor = 0x1e +KnFreeCount = 0x22 +KnPfnDeferredList = 0x2a +KNODE_SIZE = 0x2e + +/* KSPIN_LOCK_QUEUE */ +LqNext = 0x0 +LqLock = 0x4 + +/* KLOCK_QUEUE_HANDLE */ +LqhNext = 0x0 +LqhLock = 0x4 +LqhOldIrql = 0x8 +LOCK_QUEUE_HEADER_SIZE = 0xc + +/* LARGE_INTEGER */ +LiLowPart = 0x0 +LiHighPart = 0x4 + +/* LIST_ENTRY */ +LsFlink = 0x0 +LsBlink = 0x4 + +/* PEB */ +PeKernelCallbackTable = 0x2c +ProcessEnvironmentBlockLength = 0x230 + +/* KPROFILE */ +PfType = 0x0 +PfSize = 0x2 +PfProfileListEntry = 0x4 +PfProcess = 0xc +PfRangeBase = 0x10 +PfRangeLimit = 0x14 +PfBucketShift = 0x18 +PfBuffer = 0x1c +PfSegment = 0x20 +PfAffinity = 0x24 +PfSource = 0x28 +PfStarted = 0x2c +ProfileObjectLength = 0x30 + +/* PORT_MESSAGE */ +PmLength = 0x0 +PmZeroInit = 0x4 +PmClientId = 0x8 +PmProcess = 0x8 +PmThread = 0xc +PmMessageId = 0x10 +PmClientViewSize = 0x14 +PortMessageLength = 0x18 + +/* KPROCESS */ +PrType = 0x0 +PrSize = 0x2 +PrSignalState = 0x4 +PrProfileListHead = 0x10 +PrDirectoryTableBase = 0x18 +PrLdtDescriptor = 0x20 +PrIopmOffset = 0x30 +PrInt21Descriptor = 0x28 +PrVdmTrapcHandler = 0x4c +PrFlags = 0x6b +PrActiveProcessors = 0x34 +PrKernelTime = 0x38 +PrUserTime = 0x3c +PrReadyListHead = 0x40 +PrSwapListEntry = 0x48 +PrThreadListHead = 0x50 +PrProcessLock = 0x58 +PrAffinity = 0x5c +PrProcessFlags = 0x60 +PrBasePriority = 0x64 +PrQuantumReset = 0x65 +PrState = 0x66 +PrStackCount = 0x6c +KernelProcessObjectLength = 0x78 + +/* KQUEUE */ +QuType = 0x0 +QuSize = 0x2 +QuSignalState = 0x4 +QuEntryListHead = 0x10 +QuCurrentCount = 0x18 +QuMaximumCount = 0x1c +QuThreadListHead = 0x20 +QueueObjectLength = 0x28 + +/* STRING */ +StrLength = 0x0 +StrMaximumLength = 0x2 +StrBuffer = 0x4 + +/* TEB */ +TeCmTeb = 0x0 +TeExceptionList = 0x0 +TeStackBase = 0x4 +TeStackLimit = 0x8 +TeFiberData = 0x10 +TeSelf = 0x18 +TeEnvironmentPointer = 0x1c +TeClientId = 0x20 +TeActiveRpcHandle = 0x28 +TeThreadLocalStoragePointer = 0x2c +TeCountOfOwnedCriticalSections = 0x38 +TePeb = 0x30 +TeCsrClientThread = 0x3c +TeWOW32Reserved = 0xc0 +TeExceptionCode = 0x1a4 +TeActivationContextStackPointer = 0x1a8 +TeGdiClientPID = 0x6c0 +TeGdiClientTID = 0x6c4 +TeGdiThreadLocalInfo = 0x6c8 +TeglDispatchTable = 0x7c4 +TeglReserved1 = 0xb68 +TeglReserved2 = 0xbdc +TeglSectionInfo = 0xbe0 +TeglSection = 0xbe4 +TeglTable = 0xbe8 +TeglCurrentRC = 0xbec +TeglContext = 0xbf0 +TeDeallocationStack = 0xe0c +TeTlsSlots = 0xe10 +TeTlsExpansionSlots = 0xf94 +TeLastErrorValue = 0x34 +TeVdm = 0xf18 +TeInstrumentation = 0xf2c +TeGdiBatchCount = 0xf70 +TeGuaranteedStackBytes = 0xf78 +TeFlsData = 0xfb4 +ThreadEnvironmentBlockLength = 0xfbc + +/* TIME_FIELDS */ +TfSecond = 0xa +TfMinute = 0x8 +TfHour = 0x6 +TfWeekday = 0xe +TfDay = 0x4 +TfMonth = 0x2 +TfYear = 0x0 +TfMilliseconds = 0xc + +/* KTHREAD */ +ThType = 0x0 +ThSize = 0x2 +ThLock = 0x0 +ThDebugActive = 0x3 +ThSignalState = 0x4 +ThInitialStack = 0x18 +ThStackLimit = 0x1c +ThKernelStack = 0x20 +ThThreadLock = 0x24 +ThAlerted = 0x5e +ThApcState = 0x28 +ThPriority = 0x5b +ThSwapBusy = 0x5d +ThNextProcessor = 0x40 +ThDeferredProcessor = 0x41 +ThApcQueueLock = 0x44 +ThContextSwitches = 0x48 +ThState = 0x4c +ThNpxState = 0x4d +ThWaitIrql = 0x4e +ThWaitMode = 0x4f +ThWaitStatus = 0x50 +ThWaitBlockList = 0x54 +ThGateObject = 0x54 +ThWaitListEntry = 0x60 +ThSwapListEntry = 0x60 +ThQueue = 0x68 +ThWaitTime = 0x6c +ThCombinedApcDisable = 0x70 +ThKernelApcDisable = 0x70 +ThSpecialApcDisable = 0x72 +ThTeb = 0x74 +ThTimer = 0x78 +ThThreadFlags = 0xa0 +ThServiceTable = 0x118 +ThWaitBlock = 0xa8 +ThResourceIndex = 0xef +ThQueueListEntry = 0x108 +ThTrapFrame = 0x110 +ThCallbackStack = 0x114 +ThApcStateIndex = 0x11c +ThIdealProcessor = 0x11d +ThBasePriority = 0x121 +ThPriorityDecrement = 0x122 +ThAdjustReason = 0x42 +ThAdjustIncrement = 0x43 +ThPreviousMode = 0xd7 +ThSaturation = 0x123 +ThFreezeCount = 0x14f +ThUserAffinity = 0x124 +ThProcess = 0x128 +ThAffinity = 0x12c +ThUserIdealProcessor = 0x151 +ThApcStatePointer = 0x130 +ThSavedApcState = 0x138 +ThWaitReason = 0x5a +ThSuspendCount = 0x150 +ThWin32Thread = 0x154 +ThStackBase = 0x158 +ThSuspendApc = 0x15c +ThPowerState = 0x18b +ThKernelTime = 0x160 +ThLegoData = 0x184 +ThLargeStack = 0x107 +ThUserTime = 0x18c +ThSuspendSemaphore = 0x190 +ThSListFaultCount = 0x1a4 +ThThreadListEntry = 0x1a8 +ThMutantListHead = 0x10 +ThSListFaultAddress = 0x1b0 +KernelThreadObjectLength = 0x1b8 +ExecutiveThreadObjectLength = 0x250 + +/* KTIMER */ +TiType = 0x0 +TiSize = 0x2 +TiInserted = 0x3 +TiSignalState = 0x4 +TiDueTime = 0x10 +TiTimerListEntry = 0x18 +TiDpc = 0x20 +TiPeriod = 0x24 +TimerObjectLength = 0x28 + +/* TIME */ + +/* KUSER_SHARED_DATA */ +UsTickCountMultiplier = 0x4 +UsInterruptTime = 0x8 +UsSystemTime = 0x14 +UsTimeZoneBias = 0x20 +UsImageNumberLow = 0x2c +UsImageNumberHigh = 0x2e +UsNtSystemRoot = 0x30 +UsMaxStackTraceDepth = 0x238 +UsCryptoExponent = 0x23c +UsTimeZoneId = 0x240 +UsLargePageMinimum = 0x244 +UsReserved2 = 0x248 +UsNtProductType = 0x264 +UsProductTypeIsValid = 0x268 +UsNtMajorVersion = 0x26c +UsNtMinorVersion = 0x270 +UsProcessorFeatures = 0x274 +UsReserved1 = 0x2b4 +UsReserved3 = 0x2b8 +UsTimeSlip = 0x2bc +UsAlternativeArchitecture = 0x2c0 +UsSystemExpirationDate = 0x2c8 +UsSuiteMask = 0x2d0 +UsKdDebuggerEnabled = 0x2d4 +UsActiveConsoleId = 0x2d8 +UsDismountCount = 0x2dc +UsComPlusPackage = 0x2e0 +UsLastSystemRITEventTickCount = 0x2e4 +UsNumberOfPhysicalPages = 0x2e8 +UsSafeBootMode = 0x2ec +UsTestRetInstruction = 0x2f8 +UsSystemCall = 0x300 +UsSystemCallReturn = 0x304 +UsSystemCallPad = 0x308 +UsTickCount = 0x320 +UsTickCountQuad = 0x320 +UsWow64SharedInformation = 0x340 + +/* KWAIT_BLOCK */ +WbWaitListEntry = 0x0 +WbThread = 0x8 +WbObject = 0xc +WbNextWaitBlock = 0x10 +WbWaitKey = 0x14 +WbWaitType = 0x16 + +/* CR0 flags */ +CR0_PE = 0x1 +CR0_MP = 0x2 +CR0_EM = 0x4 +CR0_TS = 0x8 +CR0_ET = 0x10 +CR0_NE = 0x20 +CR0_WP = 0x10000 +CR0_AM = 0x40000 +CR0_NW = 0x20000000 +CR0_CD = 0x40000000 +CR0_PG = 0x80000000 + +/* CR4 flags */ +CR4_VME = 0x1 +CR4_PVI = 0x2 +CR4_TSD = 0x4 +CR4_DE = 0x8 +CR4_PSE = 0x10 +CR4_PAE = 0x20 +CR4_MCE = 0x40 +CR4_PGE = 0x80 +CR4_FXSR = 0x200 +CR4_XMMEXCPT = 0x400 + +/* KeFeatureBits flags */ +KF_RDTSC = 0x2 +KF_CR4 = 0x4 +KF_GLOBAL_PAGE = 0x10 +KF_LARGE_PAGE = 0x20 +KF_CMPXCHG8B = 0x80 +KF_FAST_SYSCALL = 0x1000 +KF_V86_VIS = 0x1 + +/* Machine type definitions */ +MACHINE_TYPE_ISA = 0x0 +MACHINE_TYPE_EISA = 0x1 +MACHINE_TYPE_MCA = 0x2 + +/* EFLAGS */ +EFLAGS_TF = 0x100 +EFLAGS_INTERRUPT_MASK = 0x200 +EFLAGS_V86_MASK = 0x20000 +EFLAGS_ALIGN_CHECK = 0x40000 +EFLAGS_VIF = 0x80000 +EFLAGS_VIP = 0x100000 +EFLAGS_USER_SANITIZE = 0x3f4dd7 + +/* KDGT selectors */ +KGDT_R3_DATA = 0x20 +KGDT_R3_CODE = 0x18 +KGDT_R0_CODE = 0x8 +KGDT_R0_DATA = 0x10 +KGDT_R0_PCR = 0x30 +KGDT_TSS = 0x28 +KGDT_R3_TEB = 0x38 +KGDT_DF_TSS = 0x50 +KGDT_NMI_TSS = 0x58 +KGDT_LDT = 0x48 +NPX_STATE_NOT_LOADED = 0xa +NPX_STATE_LOADED = 0x0 +PF_XMMI_INSTRUCTIONS_AVAILABLE = 0x6 +EFLAG_SELECT = 0xc000 + +/* CONTEXT */ +CsContextFlags = 0x0 +CsDr0 = 0x4 +CsDr1 = 0x8 +CsDr2 = 0xc +CsDr3 = 0x10 +CsDr6 = 0x14 +CsDr7 = 0x18 +CsFloatSave = 0x1c +CsSegGs = 0x8c +CsSegFs = 0x90 +CsSegEs = 0x94 +CsSegDs = 0x98 +CsEdi = 0x9c +CsEsi = 0xa0 +CsEbx = 0xa4 +CsEdx = 0xa8 +CsEcx = 0xac +CsEax = 0xb0 +CsEbp = 0xb4 +CsEip = 0xb8 +CsSegCs = 0xbc +CsEflags = 0xc0 +CsEsp = 0xc4 +CsSegSs = 0xc8 +CsExtendedRegisters = 0xcc +ContextFrameLength = 0x2cc +CONTEXT_LENGTH = 0x2cc + +/* KGDTENTRY */ +KgdtBaseLow = 0x2 +KgdtBaseMid = 0x4 +KgdtBaseHi = 0x7 +KgdtLimitHi = 0x6 +KgdtLimitLow = 0x0 + +/* KTRAP_FRAME */ +TsExceptionList = 0x4c +TsPreviousPreviousMode = 0x48 +TsSegGs = 0x30 +TsSegFs = 0x50 +TsSegEs = 0x34 +TsSegDs = 0x38 +TsEdi = 0x54 +TsEsi = 0x58 +TsEbp = 0x60 +TsEbx = 0x5c +TsEdx = 0x3c +TsEcx = 0x40 +TsEax = 0x44 +TsErrCode = 0x64 +TsEip = 0x68 +TsSegCs = 0x6c +TsEflags = 0x70 +TsHardwareEsp = 0x74 +TsHardwareSegSs = 0x78 +TsTempSegCs = 0x10 +TsTempEsp = 0x14 +TsDbgEbp = 0x0 +TsDbgEip = 0x4 +TsDbgArgMark = 0x8 +TsDbgArgPointer = 0xc +TsDr0 = 0x18 +TsDr1 = 0x1c +TsDr2 = 0x20 +TsDr3 = 0x24 +TsDr6 = 0x28 +TsDr7 = 0x2c +TsV86Es = 0x7c +TsV86Ds = 0x80 +TsV86Fs = 0x84 +TsV86Gs = 0x88 +KTRAP_FRAME_LENGTH = 0x8c +KTRAP_FRAME_ALIGN = 0x4 +FRAME_EDITED = 0xfff8 + +/* KTSS */ +TssEsp0 = 0x4 +TssCR3 = 0x1c +TssEip = 0x20 +TssEFlags = 0x24 +TssEax = 0x28 +TssEbx = 0x34 +TssEcx = 0x2c +TssEdx = 0x30 +TssEsp = 0x38 +TssEbp = 0x3c +TssEsi = 0x40 +TssEdi = 0x44 +TssEs = 0x48 +TssCs = 0x4c +TssSs = 0x50 +TssDs = 0x54 +TssFs = 0x58 +TssGs = 0x5c +TssLDT = 0x60 +TssIoMapBase = 0x66 +TssIoMaps = 0x68 +TssLength = 0x20ac + +/* KPCR */ +KPCR_EXCEPTION_LIST = 0x0 +KPCR_PERF_GLOBAL_GROUP_MASK = 0x8 +KPCR_CONTEXT_SWITCHES = 0x10 +KPCR_TEB = 0x18 +KPCR_SELF = 0x1c +KPCR_PRCB = 0x20 +KPCR_IDT = 0x38 +KPCR_GDT = 0x3c +KPCR_TSS = 0x40 +KPCR_STALL_SCALE_FACTOR = 0x4c +KPCR_PRCB_DATA = 0x120 +KPCR_CURRENT_THREAD = 0x124 +KPCR_PRCB_NEXT_THREAD = 0x128 +KPCR_PRCB_DPC_QUEUE_DEPTH = 0xa4c +KPCR_PRCB_DPC_STACK = 0xa68 +KPCR_PRCB_MAXIMUM_DPC_QUEUE_DEPTH = 0xa6c +KPCR_PRCB_DPC_ROUTINE_ACTIVE = 0xa7a +KPCR_PRCB_TIMER_REQUEST = 0xa88 +KPCR_PRCB_QUANTUM_END = 0xaa1 +KPCR_PRCB_DEFERRED_READY_LIST_HEAD = 0xc10 +KPCR_PRCB_POWER_STATE_IDLE_FUNCTION = 0xec0 + +/* KTRAP_FRAME */ +KTRAP_FRAME_DEBUGEBP = 0x0 +KTRAP_FRAME_DEBUGEIP = 0x4 +KTRAP_FRAME_TEMPESP = 0x14 +KTRAP_FRAME_DR0 = 0x18 +KTRAP_FRAME_DR1 = 0x1c +KTRAP_FRAME_DR2 = 0x20 +KTRAP_FRAME_DR3 = 0x24 +KTRAP_FRAME_DR6 = 0x28 +KTRAP_FRAME_DR7 = 0x2c +KTRAP_FRAME_GS = 0x30 +KTRAP_FRAME_ES = 0x34 +KTRAP_FRAME_DS = 0x38 +KTRAP_FRAME_EDX = 0x3c +KTRAP_FRAME_ECX = 0x40 +KTRAP_FRAME_EAX = 0x44 +KTRAP_FRAME_PREVIOUS_MODE = 0x48 +KTRAP_FRAME_EXCEPTION_LIST = 0x4c +KTRAP_FRAME_FS = 0x50 +KTRAP_FRAME_EDI = 0x54 +KTRAP_FRAME_ESI = 0x58 +KTRAP_FRAME_EBX = 0x5c +KTRAP_FRAME_EBP = 0x60 +KTRAP_FRAME_ERROR_CODE = 0x64 +KTRAP_FRAME_EIP = 0x68 +KTRAP_FRAME_EFLAGS = 0x70 +KTRAP_FRAME_ESP = 0x74 +KTRAP_FRAME_SS = 0x78 +KTRAP_FRAME_V86_ES = 0x7c +KTRAP_FRAME_V86_DS = 0x80 +KTRAP_FRAME_V86_FS = 0x84 +KTRAP_FRAME_V86_GS = 0x88 +KTRAP_FRAME_SIZE = 0x8c +FRAME_EDITED = 0xfff8 + +/* CONTEXT */ +CONTEXT_FLAGS = 0x0 +CONTEXT_SEGGS = 0x8c +CONTEXT_SEGFS = 0x90 +CONTEXT_SEGES = 0x94 +CONTEXT_SEGDS = 0x98 +CONTEXT_EDI = 0x9c +CONTEXT_ESI = 0xa0 +CONTEXT_EBX = 0xa4 +CONTEXT_EDX = 0xa8 +CONTEXT_ECX = 0xac +CONTEXT_EAX = 0xb0 +CONTEXT_EBP = 0xb4 +CONTEXT_EIP = 0xb8 +CONTEXT_SEGCS = 0xbc +CONTEXT_EFLAGS = 0xc0 +CONTEXT_ESP = 0xc4 +CONTEXT_SEGSS = 0xc8 +CONTEXT_FRAME_LENGTH = 0x2cc + +/* FIBER */ +FIBER_PARAMETER = 0x0 +FIBER_EXCEPTION_LIST = 0x4 +FIBER_STACK_BASE = 0x8 +FIBER_STACK_LIMIT = 0xc +FIBER_DEALLOCATION_STACK = 0x10 +FIBER_CONTEXT = 0x14 +FIBER_CONTEXT_FLAGS = 0x14 +FIBER_CONTEXT_EAX = 0xc4 +FIBER_CONTEXT_EBX = 0xb8 +FIBER_CONTEXT_ECX = 0xc0 +FIBER_CONTEXT_EDX = 0xbc +FIBER_CONTEXT_ESI = 0xb4 +FIBER_CONTEXT_EDI = 0xb0 +FIBER_CONTEXT_EBP = 0xc8 +FIBER_CONTEXT_EIP = 0xcc +FIBER_CONTEXT_ESP = 0xd8 +FIBER_CONTEXT_DR6 = 0x28 +FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD = 0x30 +FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD = 0x34 +FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD = 0x38 +FIBER_GUARANTEED_STACK_BYTES = 0x2e0 +FIBER_FLS_DATA = 0x2e4 +FIBER_ACTIVATION_CONTEXT_STACK = 0x2e8 + +/* KTSS */ +KTSS_IOMAPBASE = 0x66 +KTSS_ESP0 = 0x4 + +/* EXCEPTION_RECORD */ +EXCEPTION_RECORD_EXCEPTION_CODE = 0x0 +EXCEPTION_RECORD_EXCEPTION_FLAGS = 0x4 +EXCEPTION_RECORD_EXCEPTION_RECORD = 0x8 +EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc +EXCEPTION_RECORD_NUMBER_PARAMETERS = 0x10 +EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc +SIZEOF_EXCEPTION_RECORD = 0x50 +EXCEPTION_RECORD_LENGTH = 0x50 + +/* KTHREAD */ +KTHREAD_DEBUG_ACTIVE = 0x3 +KTHREAD_INITIAL_STACK = 0x18 +KTHREAD_STACK_LIMIT = 0x1c +KTHREAD_TEB = 0x74 +KTHREAD_KERNEL_STACK = 0x20 +KTHREAD_APCSTATE_PROCESS = 0x38 +KTHREAD_PENDING_KERNEL_APC = 0x3d +KTHREAD_CONTEXT_SWITCHES = 0x48 +KTHREAD_STATE_ = 0x4c +KTHREAD_NPX_STATE = 0x4d +KTHREAD_WAIT_IRQL = 0x4e +KTHREAD_WAIT_REASON = 0x5a +KTHREAD_COMBINED_APC_DISABLE = 0x70 +KTHREAD_SPECIAL_APC_DISABLE = 0x72 +KTHREAD_LARGE_STACK = 0x107 +KTHREAD_TRAP_FRAME = 0x110 +KTHREAD_CALLBACK_STACK = 0x114 +KTHREAD_APC_STATE_INDEX = 0x11c +KTHREAD_STACK_BASE = 0x158 + +/* KPROCESS */ +KPROCESS_DIRECTORY_TABLE_BASE = 0x18 +KPROCESS_LDT_DESCRIPTOR0 = 0x20 +KPROCESS_LDT_DESCRIPTOR1 = 0x24 +KPROCESS_INT21_DESCRIPTOR0 = 0x28 +KPROCESS_INT21_DESCRIPTOR1 = 0x2c +KPROCESS_IOPM_OFFSET = 0x30 + +/* Teb */ +TEB_EXCEPTION_LIST = 0x0 +TEB_STACK_LIMIT = 0x8 +TEB_STACK_BASE = 0x4 +TEB_SELF = 0x18 +TEB_FIBER_DATA = 0x10 +TEB_PEB = 0x30 +TEB_EXCEPTION_CODE = 0x1a4 +PEB_KERNEL_CALLBACK_TABLE = 0x2c +TEB_FLS_DATA = 0xfb4 +TEB_ACTIVATION_CONTEXT_STACK_POINTER = 0x1a8 +TEB_GUARANTEED_STACK_BYTES = 0xf78 +TEB_DEALLOCATION_STACK = 0xe0c + +/* Misc */ +NPX_FRAME_LENGTH = 0x210 +FN_CR0_NPX_STATE = 0x20c +DR7_RESERVED_MASK = 0xdc00 +FP_CONTROL_WORD = 0x0 +FP_STATUS_WORD = 0x4 +FP_TAG_WORD = 0x8 +FP_DATA_SELECTOR = 0x18 +CBSTACK_RESULT = 0x20 +CBSTACK_RESULT_LENGTH = 0x24 +CBSTACK_TRAP_FRAME = 0x4 +CBSTACK_CALLBACK_STACK = 0x8 +SIZEOF_FX_SAVE_AREA = 0x210 +KUSER_SHARED_SYSCALL = 0x7ffe0300 +EXCEPTION_EXECUTE_HANDLER = 0x1 +STATUS_CALLBACK_POP_STACK = 0xc0000423 +CONTEXT_ALIGNED_SIZE = 0x2cc +PROCESSOR_FEATURE_FXSR = 0x7ffe0278 diff --git a/reactos/lib/rtl/amd64/debug_asm.S b/reactos/lib/rtl/amd64/debug_asm.S index c115feb12fc..ca09236c566 100644 --- a/reactos/lib/rtl/amd64/debug_asm.S +++ b/reactos/lib/rtl/amd64/debug_asm.S @@ -6,7 +6,7 @@ * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org) */ -#include +#include /* GLOBALS ****************************************************************/ diff --git a/reactos/lib/rtl/amd64/except_asm.S b/reactos/lib/rtl/amd64/except_asm.S index a4b35079fcd..54f44ce445a 100644 --- a/reactos/lib/rtl/amd64/except_asm.S +++ b/reactos/lib/rtl/amd64/except_asm.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS *****************************************************************/ diff --git a/reactos/lib/rtl/amd64/rtlmem.S b/reactos/lib/rtl/amd64/rtlmem.S index d0a82068251..e75161061ee 100644 --- a/reactos/lib/rtl/amd64/rtlmem.S +++ b/reactos/lib/rtl/amd64/rtlmem.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* FUNCTIONS *****************************************************************/ diff --git a/reactos/lib/rtl/amd64/slist.S b/reactos/lib/rtl/amd64/slist.S index ca1ed3905d5..efdada51999 100644 --- a/reactos/lib/rtl/amd64/slist.S +++ b/reactos/lib/rtl/amd64/slist.S @@ -6,8 +6,8 @@ * PROGRAMMERS: Timo Kreuzer */ -#include -#include +#include +#include #define SLIST8A_DEPTH_MASK HEX(000000000000FFFF) #define SLIST8A_DEPTH_INC HEX(0000000000000001) diff --git a/reactos/lib/rtl/i386/debug_asm.S b/reactos/lib/rtl/i386/debug_asm.S index c79545f53c0..39b6fa84236 100644 --- a/reactos/lib/rtl/i386/debug_asm.S +++ b/reactos/lib/rtl/i386/debug_asm.S @@ -6,43 +6,39 @@ * PROGRAMER: Alex Ionescu (alex@relsoft.net) */ -.intel_syntax noprefix +#include /* GLOBALS ****************************************************************/ -.globl _DbgBreakPoint@0 -.globl _DbgBreakPointWithStatus@4 -.globl _DbgUserBreakPoint@0 -.globl _DebugService@20 -.globl _DebugService2@12 -.globl _DbgBreakPointNoBugCheck@0 -.globl _RtlpBreakWithStatusInstruction@0 +PUBLIC _DbgBreakPoint@0 +PUBLIC _DbgBreakPointWithStatus@4 +PUBLIC _DbgUserBreakPoint@0 +PUBLIC _DebugService@20 +PUBLIC _DebugService2@12 +PUBLIC _DbgBreakPointNoBugCheck@0 +PUBLIC _RtlpBreakWithStatusInstruction@0 /* FUNCTIONS ***************************************************************/ -.func DbgBreakPointNoBugCheck@0 +.code + _DbgBreakPointNoBugCheck@0: int 3 ret -.endfunc -.func DbgBreakPoint@0 _DbgBreakPoint@0: _DbgUserBreakPoint@0: int 3 ret -.endfunc -.func DbgBreakPointWithStatus@4 _DbgBreakPointWithStatus@4: mov eax, [esp+4] _RtlpBreakWithStatusInstruction@0: int 3 ret 4 -.endfunc -.func DebugService2@12 + _DebugService2@12: /* Setup the stack */ @@ -53,15 +49,14 @@ _DebugService2@12: mov eax, [ebp+16] mov ecx, [ebp+8] mov edx, [ebp+12] - int 0x2D + int HEX(2D) int 3 /* Restore stack */ pop ebp ret 12 -.endfunc -.func DebugService@20 + _DebugService@20: /* Setup the stack */ @@ -78,7 +73,7 @@ _DebugService@20: mov edx, [ebp+16] mov ebx, [ebp+20] mov edi, [ebp+24] - int 0x2D + int HEX(2D) int 3 /* Restore registers */ @@ -88,4 +83,5 @@ _DebugService@20: /* Return */ pop ebp ret 20 -.endfunc + +END diff --git a/reactos/lib/rtl/i386/except_asm.s b/reactos/lib/rtl/i386/except_asm.s index 9b2f856c724..53b07c69711 100644 --- a/reactos/lib/rtl/i386/except_asm.s +++ b/reactos/lib/rtl/i386/except_asm.s @@ -9,8 +9,13 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include + +EXTERN _RtlpCheckForActiveDebugger@0:PROC +EXTERN _RtlDispatchException@8:PROC +EXTERN _ZwContinue@8:PROC +EXTERN _ZwRaiseException@12:PROC #define ExceptionContinueSearch 1 #define ExceptionNestedException 2 @@ -18,17 +23,17 @@ /* FUNCTIONS *****************************************************************/ -.func RtlpGetExceptionList@0 -.globl _RtlpGetExceptionList@0 +.code + +PUBLIC _RtlpGetExceptionList@0 _RtlpGetExceptionList@0: /* Return the exception list */ mov eax, fs:[TEB_EXCEPTION_LIST] ret -.endfunc -.func RtlpSetExceptionList@4 -.globl _RtlpSetExceptionList@4 + +PUBLIC _RtlpSetExceptionList@4 _RtlpSetExceptionList@4: /* Get the new list */ @@ -40,10 +45,9 @@ _RtlpSetExceptionList@4: /* Return */ ret 4 -.endfunc -.func RtlCaptureContext@4 -.globl _RtlCaptureContext@4 + +PUBLIC _RtlCaptureContext@4 _RtlCaptureContext@4: /* Preserve EBX and put the context in it */ @@ -61,10 +65,9 @@ _RtlCaptureContext@4: /* Capture the other regs */ jmp CaptureRest -.endfunc -.func RtlpCaptureContext@4 -.globl _RtlpCaptureContext@4 + +PUBLIC _RtlpCaptureContext@4 _RtlpCaptureContext@4: /* Preserve EBX and put the context in it */ @@ -107,10 +110,9 @@ CaptureRest: /* Return to the caller */ pop ebx ret 4 -.endfunc -.func RtlpExecuteHandlerForException@20 -.globl _RtlpExecuteHandlerForException@20 + +PUBLIC _RtlpExecuteHandlerForException@20 _RtlpExecuteHandlerForException@20: /* Copy the routine in EDX */ @@ -118,16 +120,14 @@ _RtlpExecuteHandlerForException@20: /* Jump to common routine */ jmp _RtlpExecuteHandler@20 -.endfunc -.func RtlpExecuteHandlerForUnwind@20 -.globl _RtlpExecuteHandlerForUnwind@20 + +PUBLIC _RtlpExecuteHandlerForUnwind@20 _RtlpExecuteHandlerForUnwind@20: /* Copy the routine in EDX */ mov edx, offset _RtlpUnwindProtector -.endfunc -.func RtlpExecuteHandler@20 + _RtlpExecuteHandler@20: /* Save non-volatile */ @@ -142,22 +142,21 @@ _RtlpExecuteHandler@20: xor edi, edi /* Call the 2nd-stage executer */ - push [esp+0x20] - push [esp+0x20] - push [esp+0x20] - push [esp+0x20] - push [esp+0x20] + push [esp+32] + push [esp+32] + push [esp+32] + push [esp+32] + push [esp+32] call _RtlpExecuteHandler2@20 /* Restore non-volatile */ pop edi pop esi pop ebx - ret 0x14 -.endfunc + ret 20 -.func RtlpExecuteHandler2@20 -.globl _RtlpExecuteHandler2@20 + +PUBLIC _RtlpExecuteHandler2@20 _RtlpExecuteHandler2@20: /* Set up stack frame */ @@ -165,7 +164,7 @@ _RtlpExecuteHandler2@20: mov ebp, esp /* Save the Frame */ - push [ebp+0xC] + push [ebp+12] /* Push handler address */ push edx @@ -177,11 +176,11 @@ _RtlpExecuteHandler2@20: mov [fs:TEB_EXCEPTION_LIST], esp /* Call the handler */ - push [ebp+0x14] - push [ebp+0x10] - push [ebp+0xC] + push [ebp+20] + push [ebp+16] + push [ebp+12] push [ebp+8] - mov ecx, [ebp+0x18] + mov ecx, [ebp+24] call ecx /* Unlink us */ @@ -193,10 +192,9 @@ _RtlpExecuteHandler2@20: /* Undo stack frame and return */ mov esp, ebp pop ebp - ret 0x14 -.endfunc + ret 20 + -.func RtlpExceptionProtector _RtlpExceptionProtector: /* Assume we'll continue */ @@ -222,9 +220,8 @@ _RtlpExceptionProtector: return: ret 16 -.endfunc -.func RtlpUnwindProtector + _RtlpUnwindProtector: /* Assume we'll continue */ @@ -250,10 +247,9 @@ _RtlpUnwindProtector: .return: ret 16 -.endfunc -.func RtlRaiseException@4 -.globl _RtlRaiseException@4 + +PUBLIC _RtlRaiseException@4 _RtlRaiseException@4: /* Set up stack frame */ @@ -325,10 +321,9 @@ RaiseStatus1: /* If we returned, raise a status */ push eax call _RtlRaiseStatus@4 -.endfunc -.func RtlRaiseStatus@4 -.globl _RtlRaiseStatus@4 + +PUBLIC _RtlRaiseStatus@4 _RtlRaiseStatus@4: /* Set up stack frame */ @@ -398,4 +393,5 @@ RaiseStatus2: /* If we returned, raise a status */ push eax call _RtlRaiseStatus@4 -.endfunc + +END diff --git a/reactos/lib/rtl/i386/interlck.S b/reactos/lib/rtl/i386/interlck.S index 5b95e4c5429..7ad7a085216 100644 --- a/reactos/lib/rtl/i386/interlck.S +++ b/reactos/lib/rtl/i386/interlck.S @@ -6,20 +6,20 @@ * PROGRAMMERS: Timo Kreuzer */ -.intel_syntax noprefix +#include /* FUNCTIONS ****************************************************************/ - +.code /* PSLIST_ENTRY * NTAPI * RtlInterlockedPopEntrySList( * IN PSLIST_HEADER ListHead); */ -.global _ExpInterlockedPopEntrySListResume@0 -.global _ExpInterlockedPopEntrySListEnd@0 -.global _ExpInterlockedPopEntrySListFault@0 -.global _RtlInterlockedPopEntrySList@4 +PUBLIC _ExpInterlockedPopEntrySListResume@0 +PUBLIC _ExpInterlockedPopEntrySListEnd@0 +PUBLIC _ExpInterlockedPopEntrySListFault@0 +PUBLIC _RtlInterlockedPopEntrySList@4 _RtlInterlockedPopEntrySList@4: /* Save registers */ @@ -35,10 +35,9 @@ _ExpInterlockedPopEntrySListResume@0: /* Load ListHead->Depth and ListHead->Sequence into edx */ mov edx, [ebp + 4] -1: /* Check if ListHead->Next is NULL */ or eax, eax - jz 2f + jz _ExpInterlockedPopEntrySList2 /* Copy Depth and Sequence number and adjust Depth */ lea ecx, [edx - 1] @@ -54,7 +53,7 @@ _ExpInterlockedPopEntrySListEnd@0: jnz _ExpInterlockedPopEntrySListResume@0 /* Restore registers and return */ -2: +_ExpInterlockedPopEntrySList2: pop ebp pop ebx ret 4 @@ -66,7 +65,7 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PSLIST_HEADER ListHead, * IN PSLIST_ENTRY ListEntry); */ -.global _RtlInterlockedPushEntrySList@8 +PUBLIC _RtlInterlockedPushEntrySList@8 _RtlInterlockedPushEntrySList@8: /* Save registers */ @@ -85,18 +84,18 @@ _RtlInterlockedPushEntrySList@8: /* Load ListHead->Depth and ListHead->Sequence into edx */ mov edx, [ebp + 4] -1: +_RtlpInterlockedPushEntrySListResume: /* Set ListEntry->Next to ListHead->Next */ mov [ebx], eax /* Copy ListHead->Depth and ListHead->Sequence and adjust them */ - lea ecx, [edx + 0x10001] + lea ecx, [edx + HEX(10001)] /* If [ebp] equals edx:eax, exchange it with ecx:ebx */ LOCK cmpxchg8b qword ptr [ebp] /* If not equal, retry with edx:eax, being the content of [ebp] now */ - jnz 1b + jnz _RtlpInterlockedPushEntrySListResume /* Restore registers and return */ pop ebp @@ -109,7 +108,7 @@ _RtlInterlockedPushEntrySList@8: * RtlInterlockedFlushSList( * IN PSINGLE_LIST_ENTRY ListHead); */ -.global _RtlInterlockedFlushSList@4 +PUBLIC _RtlInterlockedFlushSList@4 _RtlInterlockedFlushSList@4: /* Save registers */ @@ -128,10 +127,10 @@ _RtlInterlockedFlushSList@4: /* Load ListHead->Depth and ListHead->Sequence into edx */ mov edx, [ebp + 4] -1: +_RtlpInterlockedFlushSListResume: /* Check if ListHead->Next is NULL */ or eax, eax - jz 2f + jz _RtlpInterlockedFlushSListEnd /* Copy Depth and Sequence number to ecx */ mov ecx, edx @@ -143,10 +142,12 @@ _RtlInterlockedFlushSList@4: LOCK cmpxchg8b qword ptr [ebp] /* If not equal, retry with edx:eax, being the content of [ebp] now */ - jnz 1b + jnz _RtlpInterlockedFlushSListResume /* Restore registers and return */ -2: +_RtlpInterlockedFlushSListEnd: pop ebp pop ebx ret 4 + +END diff --git a/reactos/lib/rtl/i386/res_asm.s b/reactos/lib/rtl/i386/res_asm.s index 46c61e08d42..5af744c2308 100644 --- a/reactos/lib/rtl/i386/res_asm.s +++ b/reactos/lib/rtl/i386/res_asm.s @@ -1,11 +1,22 @@ -#include -.intel_syntax noprefix +/* + * COPYRIGHT: GNU GPL - See COPYING in the top level directory + * PROJECT: ReactOS Run-Time Library + * PURPOSE: + * FILE: lib/rtl/i386/res_asm.S + * PROGRAMER: + */ + +#include +#include + +EXTERN _LdrpAccessResource@16:PROC /* * On x86, Shrinker, an executable compressor, depends on the * "call access_resource" instruction being there. */ -.globl _LdrAccessResource@16 +.code +PUBLIC _LdrAccessResource@16 _LdrAccessResource@16: push ebp mov ebp, esp @@ -18,3 +29,5 @@ _LdrAccessResource@16: call _LdrpAccessResource@16 leave ret 16 + +END diff --git a/reactos/lib/rtl/i386/rtlmem.s b/reactos/lib/rtl/i386/rtlmem.s index dea3b6d920d..d26f5b4ec52 100644 --- a/reactos/lib/rtl/i386/rtlmem.s +++ b/reactos/lib/rtl/i386/rtlmem.s @@ -1,26 +1,26 @@ /* - * COPYRIGHT: See COPYING in the top level directory + * COPYRIGHT: GNU GPL - See COPYING in the top level directory * PROJECT: ReactOS Run-Time Library * PURPOSE: Memory functions * FILE: lib/rtl/i386/rtlswap.S * PROGRAMER: Alex Ionescu (alex.ionescu@reactos.org) */ -.intel_syntax noprefix +#include /* GLOBALS *******************************************************************/ -.globl _RtlCompareMemory@12 -.globl _RtlCompareMemoryUlong@12 -.globl _RtlFillMemory@12 -.globl _RtlFillMemoryUlong@12 -.globl _RtlMoveMemory@12 -.globl _RtlZeroMemory@8 -.globl @RtlPrefetchMemoryNonTemporal@8 +PUBLIC _RtlCompareMemory@12 +PUBLIC _RtlCompareMemoryUlong@12 +PUBLIC _RtlFillMemory@12 +PUBLIC _RtlFillMemoryUlong@12 +PUBLIC _RtlMoveMemory@12 +PUBLIC _RtlZeroMemory@8 +PUBLIC @RtlPrefetchMemoryNonTemporal@8 /* FUNCTIONS *****************************************************************/ +.code -.func RtlCompareMemory@12 _RtlCompareMemory@12: /* Save volatiles */ @@ -74,9 +74,8 @@ NotEqual2: pop edi pop esi ret 12 -.endfunc -.func RtlCompareMemoryUlong@12 + _RtlCompareMemoryUlong@12: /* Get pointers and size in ULONGs */ @@ -97,9 +96,8 @@ Done: mov eax, edi pop edi ret 12 -.endfunc -.func RtlFillMemory@12 + _RtlFillMemory@12: /* Get pointers and size */ @@ -134,9 +132,8 @@ ByteFill: rep stosb pop edi ret 12 -.endfunc -.func RtlFillMemoryUlong@12 + _RtlFillMemoryUlong@12: /* Get pointer, size and pattern */ @@ -150,9 +147,8 @@ _RtlFillMemoryUlong@12: rep stosd pop edi ret 12 -.endfunc -.func RtlFillMemoryUlonglong@16 + _RtlFillMemoryUlonglong@16: /* Save volatiles */ @@ -179,9 +175,8 @@ _RtlFillMemoryUlonglong@16: pop esi pop edi ret 16 -.endfunc -.func RtlZeroMemory@8 + _RtlZeroMemory@8: /* Get pointers and size */ @@ -212,9 +207,8 @@ ByteZero: rep stosb pop edi ret 8 -.endfunc -.func RtlMoveMemory@12 + _RtlMoveMemory@12: /* Save volatiles */ @@ -280,9 +274,8 @@ Overlap: rep movsb cld jmp DoneMove -.endfunc -.func @RtlPrefetchMemoryNonTemporal@8, @RtlPrefetchMemoryNonTemporal@8 + @RtlPrefetchMemoryNonTemporal@8: /* @@ -306,8 +299,10 @@ FetchLine: /* Keep looping for the next line, or return if done */ ja FetchLine ret -.endfunc + /* FIXME: HACK */ _Ke386CacheAlignment: - .long 0x40 + .long 64 + +END diff --git a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s index 4008d4f5eab..b1486dea898 100644 --- a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s +++ b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s @@ -8,11 +8,10 @@ /* INCLUDES ******************************************************************/ -#include +#include -.intel_syntax noprefix -.global MsgUnimplemented +PUBLIC MsgUnimplemented MsgUnimplemented: .asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" @@ -27,4 +26,5 @@ MsgUnimplemented: ret .endp +END /* EOF */ diff --git a/reactos/lib/sdk/crt/except/amd64/seh.s b/reactos/lib/sdk/crt/except/amd64/seh.s index e784457e9f8..9d44d3ffd4d 100644 --- a/reactos/lib/sdk/crt/except/amd64/seh.s +++ b/reactos/lib/sdk/crt/except/amd64/seh.s @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include #define DISPOSITION_DISMISS 0 #define DISPOSITION_CONTINUE_SEARCH 1 @@ -54,3 +54,5 @@ _except_handler2: _except_handler3: ret .endfunc + +END diff --git a/reactos/lib/sdk/crt/except/i386/chkstk_asm.s b/reactos/lib/sdk/crt/except/i386/chkstk_asm.s index 5104a35b1c4..58879f18d0f 100644 --- a/reactos/lib/sdk/crt/except/i386/chkstk_asm.s +++ b/reactos/lib/sdk/crt/except/i386/chkstk_asm.s @@ -7,8 +7,43 @@ * PROGRAMER: KJK::Hyperion */ -.globl __chkstk -.globl __alloca_probe +#include +#include + +#define PAGE_SIZE 4096 + +PUBLIC __chkstk +PUBLIC __alloca_probe +PUBLIC __alloca_probe_16 +.code + + /* 16 byte aligned alloca probe + * EAX = size to be allocated */ +__alloca_probe_16: + /* save the ECX register */ + push ecx + + /* ecx = top of the previous stack frame */ + lea ecx, [esp + 8] + + /* Calculate end of allocation */ + sub ecx, eax + + /* Get the misalignment */ + and ecx, 15 + + /* Add the misalignment to the original alloc size */ + add eax, ecx + + /* Check for overflow */ + jnc l1 + + /* Set maximum value */ + mov eax, HEX(0ffffffff) +l1: + /* Restore ecx */ + pop ecx + /* Fall through to __chkstk */ /* _chkstk() is called by all stack allocations of more than 4 KB. It grows the @@ -18,49 +53,49 @@ __chkstk: __alloca_probe: -/* EAX = size to be allocated */ -/* save the ECX register */ - pushl %ecx + /* EAX = size to be allocated */ + /* save the ECX register */ + push ecx -/* ECX = top of the previous stack frame */ - leal 8(%esp), %ecx + /* ECX = top of the previous stack frame */ + lea ecx, [esp + 8] -/* probe the desired memory, page by page */ - cmpl $0x1000, %eax - jge .l_MoreThanAPage - jmp .l_LessThanAPage + /* probe the desired memory, page by page */ + cmp eax, PAGE_SIZE + jl .l_LessThanAPage .l_MoreThanAPage: -/* raise the top of the stack by a page and probe */ - subl $0x1000, %ecx - testl %eax, 0(%ecx) + /* raise the top of the stack by a page and probe */ + sub ecx, PAGE_SIZE + test [ecx], eax -/* loop if still more than a page must be probed */ - subl $0x1000, %eax - cmpl $0x1000, %eax - jge .l_MoreThanAPage + /* loop if still more than a page must be probed */ + sub eax, PAGE_SIZE + cmp eax, PAGE_SIZE + jge .l_MoreThanAPage .l_LessThanAPage: -/* raise the top of the stack by EAX bytes (size % 4096) and probe */ - subl %eax, %ecx - testl %eax, 0(%ecx) + /* raise the top of the stack by EAX bytes (size % 4096) and probe */ + sub ecx, eax + test [ecx], eax -/* EAX = top of the stack */ - movl %esp, %eax + /* EAX = top of the stack */ + mov eax, esp -/* allocate the memory */ - movl %ecx, %esp + /* allocate the memory */ + mov esp, ecx -/* restore ECX */ - movl 0(%eax), %ecx + /* restore ECX */ + mov ecx, [eax] -/* restore the return address */ - movl 4(%eax), %eax - pushl %eax + /* restore the return address */ + mov eax, [eax + 4] + push eax -/* return */ - ret + /* return */ + ret /* EOF */ +END diff --git a/reactos/lib/sdk/crt/except/i386/prolog.s b/reactos/lib/sdk/crt/except/i386/prolog.s index 5ff588d6746..ebbf4ee412d 100644 --- a/reactos/lib/sdk/crt/except/i386/prolog.s +++ b/reactos/lib/sdk/crt/except/i386/prolog.s @@ -8,20 +8,23 @@ /* INCLUDES ******************************************************************/ -#include +#include +#include -/* GLOBALS *******************************************************************/ - -.globl __EH_prolog +/* FUNCTIONS *****************************************************************/ +.code +PUBLIC __EH_prolog // Copied from Wine. __EH_prolog: - pushl $-1 - pushl %eax - pushl %fs:0 - movl %esp, %fs:0 - movl 12(%esp), %eax - movl %ebp, 12(%esp) - leal 12(%esp), %ebp - pushl %eax + push -1 + push eax + push fs:0 + mov fs:0, esp + mov eax, [esp + 12] + mov [esp + 12], ebp + lea ebp, [esp + 12] + push eax ret + +END diff --git a/reactos/lib/sdk/crt/except/i386/seh.s b/reactos/lib/sdk/crt/except/i386/seh.s index 15a8cc5777a..6fde1e181f7 100644 --- a/reactos/lib/sdk/crt/except/i386/seh.s +++ b/reactos/lib/sdk/crt/except/i386/seh.s @@ -8,24 +8,29 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include #define DISPOSITION_DISMISS 0 #define DISPOSITION_CONTINUE_SEARCH 1 #define DISPOSITION_COLLIDED_UNWIND 3 +#define EXCEPTION_EXIT_UNWIND 4 +#define EXCEPTION_UNWINDING 2 + + +EXTERN _RtlUnwind@16:PROC + /* GLOBALS *******************************************************************/ -.globl __global_unwind2 -.globl __local_unwind2 -.globl __abnormal_termination -.globl __except_handler2 -.globl __except_handler3 +PUBLIC __global_unwind2 +PUBLIC __local_unwind2 +PUBLIC __abnormal_termination +PUBLIC __except_handler2 +PUBLIC __except_handler3 /* FUNCTIONS *****************************************************************/ -.func unwind_handler +.code _unwind_handler: /* Check if we were unwinding and continue search if not */ @@ -56,9 +61,8 @@ _unwind_handler: unwind_handler_return: ret -.endfunc -.func _global_unwind2 + __global_unwind2: /* Create stack and save all registers */ @@ -85,9 +89,8 @@ glu_return: mov esp, ebp pop ebp ret -.endfunc -.func _abnormal_termination + __abnormal_termination: /* Assume false */ @@ -112,9 +115,8 @@ __abnormal_termination: /* Return */ ab_return: ret -.endfunc -.func _local_unwind2 + __local_unwind2: /* Save volatiles */ @@ -175,9 +177,8 @@ unwind_return: pop esi pop ebx ret -.endfunc -.func _except_handler2 + __except_handler2: /* Setup stack and save volatiles */ @@ -256,7 +257,7 @@ except_loop2: mov [ebx+12], eax /* Call except handler */ - call [edi+ecx*4+8] + call dword ptr [edi+ecx*4+8] except_continue2: /* Reload try level and except again */ @@ -297,9 +298,8 @@ except_return2: mov esp, ebp pop ebp ret -.endfunc -.func _except_handler3 + __except_handler3: /* Setup stack and save volatiles */ @@ -437,4 +437,5 @@ except_return3: mov esp, ebp pop ebp ret -.endfunc + +END diff --git a/reactos/lib/sdk/crt/float/i386/logb.c b/reactos/lib/sdk/crt/float/i386/logb.c index 0c02c0e0f11..e4b61949fc4 100644 --- a/reactos/lib/sdk/crt/float/i386/logb.c +++ b/reactos/lib/sdk/crt/float/i386/logb.c @@ -30,7 +30,7 @@ double _logb (double __x) ("fxtract\n\t" : "=t" (__junk), "=u" (__val) : "0" (__x)); #else -#error REVIEW ME +#pragma message ("REVIEW ME") __asm fld [__x]; __asm fxtract; __asm fstp st(0); diff --git a/reactos/lib/sdk/crt/math/amd64/alldiv.S b/reactos/lib/sdk/crt/math/amd64/alldiv.S index 831ef50981b..b4018cc4739 100644 --- a/reactos/lib/sdk/crt/math/amd64/alldiv.S +++ b/reactos/lib/sdk/crt/math/amd64/alldiv.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/atan.S b/reactos/lib/sdk/crt/math/amd64/atan.S index 3ba194931f4..889f10e2825 100644 --- a/reactos/lib/sdk/crt/math/amd64/atan.S +++ b/reactos/lib/sdk/crt/math/amd64/atan.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/atan2.S b/reactos/lib/sdk/crt/math/amd64/atan2.S index 7cd29b93269..fd611101f0a 100644 --- a/reactos/lib/sdk/crt/math/amd64/atan2.S +++ b/reactos/lib/sdk/crt/math/amd64/atan2.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/ceil.S b/reactos/lib/sdk/crt/math/amd64/ceil.S index dbee413f491..17ae0150717 100644 --- a/reactos/lib/sdk/crt/math/amd64/ceil.S +++ b/reactos/lib/sdk/crt/math/amd64/ceil.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/ceilf.S b/reactos/lib/sdk/crt/math/amd64/ceilf.S index e3a948fff8a..2b2d14b03f0 100644 --- a/reactos/lib/sdk/crt/math/amd64/ceilf.S +++ b/reactos/lib/sdk/crt/math/amd64/ceilf.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ @@ -17,24 +17,30 @@ PUBLIC ceilf ceilf: + sub rsp, 16 + /* Put parameter on the stack */ - movss [rsp - 0x10], xmm0 - fld dword ptr [rsp] + movss [rsp], xmm0 + fld dword ptr [rsp] /* Change fpu control word to round up */ - fstcw [rsp - 0x10] - mov eax, [rsp - 0x10] - or eax, 0x00800 - and eax, 0x0fbff - mov [rsp - 0x08], eax - fldcw [rsp - 0x08] + fstcw [rsp + 8] + mov eax, [rsp + 8] + or eax, HEX(00800) + and eax, HEX(0fbff) + mov [rsp + 12], eax + fldcw [rsp + 12] /* Round to integer */ frndint /* Restore fpu control word */ - fldcw [rsp - 0x10] + fldcw [rsp + 8] - fstp dword ptr [rsp - 0x10] - movss xmm0, [rsp - 0x10] + fstp dword ptr [rsp] + movss xmm0, [rsp] + + add rsp, 16 ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/exp.S b/reactos/lib/sdk/crt/math/amd64/exp.S index ca3dc993182..44b324e4267 100644 --- a/reactos/lib/sdk/crt/math/amd64/exp.S +++ b/reactos/lib/sdk/crt/math/amd64/exp.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ @@ -20,3 +20,4 @@ exp: UNIMPLEMENTED exp ret +END diff --git a/reactos/lib/sdk/crt/math/amd64/fabs.S b/reactos/lib/sdk/crt/math/amd64/fabs.S index e58b960ecab..3c1e8f2dcf1 100644 --- a/reactos/lib/sdk/crt/math/amd64/fabs.S +++ b/reactos/lib/sdk/crt/math/amd64/fabs.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/floor.S b/reactos/lib/sdk/crt/math/amd64/floor.S index f1c3b9305af..c0fba3dd066 100644 --- a/reactos/lib/sdk/crt/math/amd64/floor.S +++ b/reactos/lib/sdk/crt/math/amd64/floor.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ @@ -19,3 +19,5 @@ PUBLIC floor floor: UNIMPLEMENTED floor ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/floorf.S b/reactos/lib/sdk/crt/math/amd64/floorf.S index e2d02202df7..0ac9098b9a3 100644 --- a/reactos/lib/sdk/crt/math/amd64/floorf.S +++ b/reactos/lib/sdk/crt/math/amd64/floorf.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* FUNCTIONS ****************************************************************/ @@ -17,24 +17,29 @@ PUBLIC floorf floorf: + sub rsp, 16 + /* Put parameter on the stack */ - movss [rsp - 0x10], xmm0 + movss [rsp], xmm0 fld dword ptr [rsp] /* Change fpu control word to round down */ - fstcw [rsp - 0x10] - mov eax, [rsp - 0x10] + fstcw [rsp] + mov eax, [rsp] or eax, 0x00400 and eax, 0x0f7ff - mov [rsp - 0x08], eax - fldcw [rsp - 0x08] + mov [rsp + 8], eax + fldcw [rsp + 8] /* Round to integer */ frndint /* Restore fpu control word */ - fldcw [rsp - 0x10] + fldcw [rsp] - fstp dword ptr [rsp - 0x10] - movss xmm0, [rsp - 0x10] + fstp dword ptr [rsp] + movss xmm0, [rsp] + add rsp, 16 ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/fmod.S b/reactos/lib/sdk/crt/math/amd64/fmod.S index 4ca67f55bfb..697257ab368 100644 --- a/reactos/lib/sdk/crt/math/amd64/fmod.S +++ b/reactos/lib/sdk/crt/math/amd64/fmod.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ @@ -17,3 +16,5 @@ PUBLIC fmod fmod: UNIMPLEMENTED fmod ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/fmodf.S b/reactos/lib/sdk/crt/math/amd64/fmodf.S index e109c387cc8..d0e24ef9529 100644 --- a/reactos/lib/sdk/crt/math/amd64/fmodf.S +++ b/reactos/lib/sdk/crt/math/amd64/fmodf.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ @@ -17,3 +16,5 @@ PUBLIC fmodf fmodf: UNIMPLEMENTED fmodf ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/ldexp.S b/reactos/lib/sdk/crt/math/amd64/ldexp.S index d0265629bf6..a83660ae7a3 100644 --- a/reactos/lib/sdk/crt/math/amd64/ldexp.S +++ b/reactos/lib/sdk/crt/math/amd64/ldexp.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ @@ -17,3 +16,5 @@ PUBLIC ldexp ldexp: UNIMPLEMENTED ldexp ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/log.S b/reactos/lib/sdk/crt/math/amd64/log.S index 9fa02763b9e..1289a745cba 100644 --- a/reactos/lib/sdk/crt/math/amd64/log.S +++ b/reactos/lib/sdk/crt/math/amd64/log.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/log10.S b/reactos/lib/sdk/crt/math/amd64/log10.S index 007f0d80e98..f8014aa5bc6 100644 --- a/reactos/lib/sdk/crt/math/amd64/log10.S +++ b/reactos/lib/sdk/crt/math/amd64/log10.S @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include /* DATA *********************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/pow.S b/reactos/lib/sdk/crt/math/amd64/pow.S index 37988801b11..48adf3961f3 100644 --- a/reactos/lib/sdk/crt/math/amd64/pow.S +++ b/reactos/lib/sdk/crt/math/amd64/pow.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* DATA *********************************************************************/ diff --git a/reactos/lib/sdk/crt/math/amd64/sqrt.S b/reactos/lib/sdk/crt/math/amd64/sqrt.S index 758d8768d4f..282419e78a5 100644 --- a/reactos/lib/sdk/crt/math/amd64/sqrt.S +++ b/reactos/lib/sdk/crt/math/amd64/sqrt.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* DATA *********************************************************************/ @@ -17,3 +17,5 @@ PUBLIC sqrt sqrt: UNIMPLEMENTED sqrt ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/sqrtf.S b/reactos/lib/sdk/crt/math/amd64/sqrtf.S index a4ee3fa6cc5..da75fcf42f5 100644 --- a/reactos/lib/sdk/crt/math/amd64/sqrtf.S +++ b/reactos/lib/sdk/crt/math/amd64/sqrtf.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* DATA *********************************************************************/ @@ -17,3 +17,5 @@ PUBLIC sqrtf sqrtf: sqrtss xmm0, xmm0 ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/tan.S b/reactos/lib/sdk/crt/math/amd64/tan.S index a7c66d0ccd7..93e5d01d762 100644 --- a/reactos/lib/sdk/crt/math/amd64/tan.S +++ b/reactos/lib/sdk/crt/math/amd64/tan.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* DATA *********************************************************************/ @@ -17,3 +17,5 @@ PUBLIC tan tan: UNIMPLEMENTED tan ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/alldiv_asm.s b/reactos/lib/sdk/crt/math/i386/alldiv_asm.s index 043a8af95c3..5061fb7c21f 100644 --- a/reactos/lib/sdk/crt/math/i386/alldiv_asm.s +++ b/reactos/lib/sdk/crt/math/i386/alldiv_asm.s @@ -33,18 +33,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - - .globl __alldiv - .globl __fltused - + +#include + +PUBLIC __alldiv +PUBLIC __fltused + /* DATA ********************************************************************/ +.data +ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING __fltused: - .long 0x9875 + .long HEX(9875) -.intel_syntax noprefix /* FUNCTIONS ***************************************************************/ +.code // // lldiv - signed long divide @@ -222,3 +226,5 @@ L8: pop edi ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/alldvrm_asm.s b/reactos/lib/sdk/crt/math/i386/alldvrm_asm.s index 8f775d6dac3..a055d55d62e 100644 --- a/reactos/lib/sdk/crt/math/i386/alldvrm_asm.s +++ b/reactos/lib/sdk/crt/math/i386/alldvrm_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __alldvrm - -.intel_syntax noprefix +#include + +PUBLIC __alldvrm + /* FUNCTIONS ***************************************************************/ +.code __alldvrm: push edi @@ -88,7 +89,7 @@ __alldvrm: mov eax,DVNDHI // hi word of a or eax,eax // test to see if signed - jge short ....L1 // skip rest if a is already positive + jge short .L1 // skip rest if a is already positive inc edi // complement result sign flag inc ebp // complement result sign flag mov edx,DVNDLO // lo word of a @@ -97,10 +98,10 @@ __alldvrm: sbb eax,0 mov DVNDHI,eax // save positive value mov DVNDLO,edx -....L1: +.L1: mov eax,DVSRHI // hi word of b or eax,eax // test to see if signed - jge short ....L2 // skip rest if b is already positive + jge short .L2 // skip rest if b is already positive inc edi // complement the result sign flag mov edx,DVSRLO // lo word of a neg eax // make b positive @@ -108,7 +109,7 @@ __alldvrm: sbb eax,0 mov DVSRHI,eax // save positive value mov DVSRLO,edx -....L2: +.L2: // // Now do the divide. First look to see if the divisor is less than 4194304K. @@ -119,7 +120,7 @@ __alldvrm: // or eax,eax // check to see if divisor < 4194304K - jnz short ....L3 // nope, gotta do this the hard way + jnz short .L3 // nope, gotta do this the hard way mov ecx,DVSRLO // load divisor mov eax,DVNDHI // load high word of dividend xor edx,edx @@ -137,24 +138,24 @@ __alldvrm: mov eax,esi // set up low word of quotient mul dword ptr DVSRLO // LOWORD(QUOT) * DVSR add edx,ecx // EDX:EAX = QUOT * DVSR - jmp short ....L4 // complete remainder calculation + jmp short .L4 // complete remainder calculation // // Here we do it the hard way. Remember, eax contains the high word of DVSR // -....L3: +.L3: mov ebx,eax // ebx:ecx <- divisor mov ecx,DVSRLO mov edx,DVNDHI // edx:eax <- dividend mov eax,DVNDLO -....L5: +.L5: shr ebx,1 // shift divisor right one bit rcr ecx,1 shr edx,1 // shift dividend right one bit rcr eax,1 or ebx,ebx - jnz short ....L5 // loop until divisor < 4194304K + jnz short .L5 // loop until divisor < 4194304K div ecx // now divide, ignore remainder mov esi,eax // save quotient @@ -170,7 +171,7 @@ __alldvrm: mov eax,DVSRLO mul esi // QUOT * DVSRLO add edx,ecx // EDX:EAX = QUOT * DVSR - jc short ....L6 // carry means Quotient is off by 1 + jc short .L6 // carry means Quotient is off by 1 // // do long compare here between original dividend and the result of the @@ -179,18 +180,18 @@ __alldvrm: // cmp edx,DVNDHI // compare hi words of result and original - ja short ....L6 // if result > original, do subtract - jb short ....L7 // if result < original, we are ok + ja short .L6 // if result > original, do subtract + jb short .L7 // if result < original, we are ok cmp eax,DVNDLO // hi words are equal, compare lo words - jbe short ....L7 // if less or equal we are ok, else subtract -....L6: + jbe short .L7 // if less or equal we are ok, else subtract +.L6: dec esi // subtract 1 from quotient sub eax,DVSRLO // subtract divisor from result sbb edx,DVSRHI -....L7: +.L7: xor ebx,ebx // ebx:esi <- quotient -....L4: +.L4: // // Calculate remainder by subtracting the result from the original dividend. // Since the result is already in a register, we will do the subtract in the @@ -208,7 +209,7 @@ __alldvrm: // dec ebp // check result sign flag - jns short ....L9 // result is ok, set up the quotient + jns short .L9 // result is ok, set up the quotient neg edx // otherwise, negate the result neg eax sbb edx,0 @@ -216,7 +217,7 @@ __alldvrm: // // Now we need to get the quotient into edx:eax and the remainder into ebx:ecx. // -....L9: +.L9: mov ecx,edx mov edx,ebx mov ebx,ecx @@ -229,7 +230,7 @@ __alldvrm: // dec edi // check to see if result is negative - jnz short ....L8 // if EDI == 0, result should be negative + jnz short .L8 // if EDI == 0, result should be negative neg edx // otherwise, negate the result neg eax sbb edx,0 @@ -238,9 +239,11 @@ __alldvrm: // Restore the saved registers and return. // -....L8: +.L8: pop ebp pop esi pop edi ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/allmul_asm.s b/reactos/lib/sdk/crt/math/i386/allmul_asm.s index ddfa7cf7b46..b9a47baafcc 100644 --- a/reactos/lib/sdk/crt/math/i386/allmul_asm.s +++ b/reactos/lib/sdk/crt/math/i386/allmul_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __allmul -.intel_syntax noprefix +#include + +PUBLIC __allmul /* FUNCTIONS ***************************************************************/ +.code // // llmul - long multiply routine @@ -113,3 +114,4 @@ hard: ret 16 // callee restores the stack +END diff --git a/reactos/lib/sdk/crt/math/i386/allrem_asm.s b/reactos/lib/sdk/crt/math/i386/allrem_asm.s index a8e222e25bf..2c3e68c5578 100644 --- a/reactos/lib/sdk/crt/math/i386/allrem_asm.s +++ b/reactos/lib/sdk/crt/math/i386/allrem_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __allrem - -.intel_syntax noprefix +#include + +PUBLIC __allrem + /* FUNCTIONS ***************************************************************/ +.code // // llrem - signed long remainder @@ -227,3 +228,5 @@ __allrem : pop ebx ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/allshl_asm.s b/reactos/lib/sdk/crt/math/i386/allshl_asm.s index b5d574aff01..48d06b7dd5a 100644 --- a/reactos/lib/sdk/crt/math/i386/allshl_asm.s +++ b/reactos/lib/sdk/crt/math/i386/allshl_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __allshl -.intel_syntax noprefix +#include + +PUBLIC __allshl /* FUNCTIONS ***************************************************************/ +.code // // llshl - long shift left @@ -92,3 +93,5 @@ RETZERO: xor eax,eax xor edx,edx ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/allshr_asm.s b/reactos/lib/sdk/crt/math/i386/allshr_asm.s index 575fc92db9a..e2b60bd97aa 100644 --- a/reactos/lib/sdk/crt/math/i386/allshr_asm.s +++ b/reactos/lib/sdk/crt/math/i386/allshr_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __allshr - -.intel_syntax noprefix +#include + +PUBLIC __allshr + /* FUNCTIONS ***************************************************************/ +.code // // llshr - long shift right @@ -93,3 +94,5 @@ __allshr: sar edx,31 mov eax,edx ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/atan2_asm.s b/reactos/lib/sdk/crt/math/i386/atan2_asm.s new file mode 100644 index 00000000000..699b02d3530 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/atan2_asm.s @@ -0,0 +1,18 @@ + +#include + +PUBLIC _atan2 + +.code +_atan2: + push ebp + mov ebp, esp + + fld qword ptr [ebp + 8] + fld qword ptr [ebp + 16] + fpatan + + pop ebp + ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/atan_asm.s b/reactos/lib/sdk/crt/math/i386/atan_asm.s index 37554c940ae..9cd08752369 100644 --- a/reactos/lib/sdk/crt/math/i386/atan_asm.s +++ b/reactos/lib/sdk/crt/math/i386/atan_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _atan - -.intel_syntax noprefix +#include + +PUBLIC _atan + /* FUNCTIONS ***************************************************************/ +.code _atan: push ebp @@ -48,3 +49,5 @@ _atan: fpatan // Take the arctangent pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/aulldiv_asm.s b/reactos/lib/sdk/crt/math/i386/aulldiv_asm.s index 565914eb87b..b3a08787c1c 100644 --- a/reactos/lib/sdk/crt/math/i386/aulldiv_asm.s +++ b/reactos/lib/sdk/crt/math/i386/aulldiv_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - - .globl __aulldiv -.intel_syntax noprefix +#include + +PUBLIC __aulldiv /* FUNCTIONS ***************************************************************/ +.code // // ulldiv - unsigned long divide @@ -105,7 +106,7 @@ __aulldiv: mov eax,DVSRHI // check to see if divisor < 4194304K or eax,eax - jnz short ..L1 // nope, gotta do this the hard way + jnz short .L1 // nope, gotta do this the hard way mov ecx,DVSRLO // load divisor mov eax,DVNDHI // load high word of dividend xor edx,edx @@ -114,24 +115,24 @@ __aulldiv: mov eax,DVNDLO // edx:eax <- remainder:lo word of dividend div ecx // get low order bits of quotient mov edx,ebx // edx:eax <- quotient hi:quotient lo - jmp short ..L2 // restore stack and return + jmp short .L2 // restore stack and return // // Here we do it the hard way. Remember, eax contains DVSRHI // -..L1: +.L1: mov ecx,eax // ecx:ebx <- divisor mov ebx,DVSRLO mov edx,DVNDHI // edx:eax <- dividend mov eax,DVNDLO -..L3: +.L3: shr ecx,1 // shift divisor right one bit// hi bit <- 0 rcr ebx,1 shr edx,1 // shift dividend right one bit// hi bit <- 0 rcr eax,1 or ecx,ecx - jnz short ..L3 // loop until divisor < 4194304K + jnz short .L3 // loop until divisor < 4194304K div ebx // now divide, ignore remainder mov esi,eax // save quotient @@ -147,7 +148,7 @@ __aulldiv: mov eax,DVSRLO mul esi // QUOT * DVSRLO add edx,ecx // EDX:EAX = QUOT * DVSR - jc short ..L4 // carry means Quotient is off by 1 + jc short .L4 // carry means Quotient is off by 1 // // do long compare here between original dividend and the result of the @@ -156,13 +157,13 @@ __aulldiv: // cmp edx,DVNDHI // compare hi words of result and original - ja short ..L4 // if result > original, do subtract - jb short ..L5 // if result < original, we are ok + ja short .L4 // if result > original, do subtract + jb short .L5 // if result < original, we are ok cmp eax,DVNDLO // hi words are equal, compare lo words - jbe short ..L5 // if less or equal we are ok, else subtract -..L4: + jbe short .L5 // if less or equal we are ok, else subtract +.L4: dec esi // subtract 1 from quotient -..L5: +.L5: xor edx,edx // edx:eax <- quotient mov eax,esi @@ -171,9 +172,11 @@ __aulldiv: // Restore the saved registers and return. // -..L2: +.L2: pop esi pop ebx ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/aulldvrm_asm.s b/reactos/lib/sdk/crt/math/i386/aulldvrm_asm.s index 6f7de08f2b2..ed1d4a10832 100644 --- a/reactos/lib/sdk/crt/math/i386/aulldvrm_asm.s +++ b/reactos/lib/sdk/crt/math/i386/aulldvrm_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __aulldvrm - -.intel_syntax noprefix +#include + +PUBLIC __aulldvrm + /* FUNCTIONS ***************************************************************/ +.code __aulldvrm: @@ -101,7 +102,7 @@ __aulldvrm: mov eax,DVSRHI // check to see if divisor < 4194304K or eax,eax - jnz short .....L1 // nope, gotta do this the hard way + jnz short .L1 // nope, gotta do this the hard way mov ecx,DVSRLO // load divisor mov eax,DVNDHI // load high word of dividend xor edx,edx @@ -120,24 +121,24 @@ __aulldvrm: mov eax,esi // set up low word of quotient mul dword ptr DVSRLO // LOWORD(QUOT) * DVSR add edx,ecx // EDX:EAX = QUOT * DVSR - jmp short .....L2 // complete remainder calculation + jmp short .L2 // complete remainder calculation // // Here we do it the hard way. Remember, eax contains DVSRHI // -.....L1: +.L1: mov ecx,eax // ecx:ebx <- divisor mov ebx,DVSRLO mov edx,DVNDHI // edx:eax <- dividend mov eax,DVNDLO -.....L3: +.L3: shr ecx,1 // shift divisor right one bit// hi bit <- 0 rcr ebx,1 shr edx,1 // shift dividend right one bit// hi bit <- 0 rcr eax,1 or ecx,ecx - jnz short .....L3 // loop until divisor < 4194304K + jnz short .L3 // loop until divisor < 4194304K div ebx // now divide, ignore remainder mov esi,eax // save quotient @@ -153,7 +154,7 @@ __aulldvrm: mov eax,DVSRLO mul esi // QUOT * DVSRLO add edx,ecx // EDX:EAX = QUOT * DVSR - jc short .....L4 // carry means Quotient is off by 1 + jc short .L4 // carry means Quotient is off by 1 // // do long compare here between original dividend and the result of the @@ -162,18 +163,18 @@ __aulldvrm: // cmp edx,DVNDHI // compare hi words of result and original - ja short .....L4 // if result > original, do subtract - jb short .....L5 // if result < original, we are ok + ja short .L4 // if result > original, do subtract + jb short .L5 // if result < original, we are ok cmp eax,DVNDLO // hi words are equal, compare lo words - jbe short .....L5 // if less or equal we are ok, else subtract -.....L4: + jbe short .L5 // if less or equal we are ok, else subtract +.L4: dec esi // subtract 1 from quotient sub eax,DVSRLO // subtract divisor from result sbb edx,DVSRHI -.....L5: +.L5: xor ebx,ebx // ebx:esi <- quotient -.....L2: +.L2: // // Calculate remainder by subtracting the result from the original dividend. // Since the result is already in a register, we will do the subtract in the @@ -202,3 +203,5 @@ __aulldvrm: pop esi ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/aullrem_asm.s b/reactos/lib/sdk/crt/math/i386/aullrem_asm.s index bfcb0efb2a0..4fde84a01ba 100644 --- a/reactos/lib/sdk/crt/math/i386/aullrem_asm.s +++ b/reactos/lib/sdk/crt/math/i386/aullrem_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __aullrem - -.intel_syntax noprefix +#include + +PUBLIC __aullrem + /* FUNCTIONS ***************************************************************/ +.code // // ullrem - unsigned long remainder @@ -101,7 +102,7 @@ __aullrem: mov eax,DVSRHI // check to see if divisor < 4194304K or eax,eax - jnz short ...L1 // nope, gotta do this the hard way + jnz short .L1 // nope, gotta do this the hard way mov ecx,DVSRLO // load divisor mov eax,DVNDHI // load high word of dividend xor edx,edx @@ -110,24 +111,24 @@ __aullrem: div ecx // edx <- final remainder mov eax,edx // edx:eax <- remainder xor edx,edx - jmp short ...L2 // restore stack and return + jmp short .L2 // restore stack and return // // Here we do it the hard way. Remember, eax contains DVSRHI // -...L1: +.L1: mov ecx,eax // ecx:ebx <- divisor mov ebx,DVSRLO mov edx,DVNDHI // edx:eax <- dividend mov eax,DVNDLO -...L3: +.L3: shr ecx,1 // shift divisor right one bit// hi bit <- 0 rcr ebx,1 shr edx,1 // shift dividend right one bit// hi bit <- 0 rcr eax,1 or ecx,ecx - jnz short ...L3 // loop until divisor < 4194304K + jnz short .L3 // loop until divisor < 4194304K div ebx // now divide, ignore remainder // @@ -142,7 +143,7 @@ __aullrem: xchg ecx,eax // put partial product in ECX, get quotient in EAX mul dword ptr DVSRLO add edx,ecx // EDX:EAX = QUOT * DVSR - jc short ...L4 // carry means Quotient is off by 1 + jc short .L4 // carry means Quotient is off by 1 // // do long compare here between original dividend and the result of the @@ -151,14 +152,14 @@ __aullrem: // cmp edx,DVNDHI // compare hi words of result and original - ja short ...L4 // if result > original, do subtract - jb short ...L5 // if result < original, we're ok + ja short .L4 // if result > original, do subtract + jb short .L5 // if result < original, we're ok cmp eax,DVNDLO // hi words are equal, compare lo words - jbe short ...L5 // if less or equal we're ok, else subtract -...L4: + jbe short .L5 // if less or equal we're ok, else subtract +.L4: sub eax,DVSRLO // subtract divisor from result sbb edx,DVSRHI -...L5: +.L5: // // Calculate remainder by subtracting the result from the original dividend. @@ -177,8 +178,10 @@ __aullrem: // Restore the saved registers and return. // -...L2: +.L2: pop ebx ret 16 + +END diff --git a/reactos/lib/sdk/crt/math/i386/aullshr_asm.s b/reactos/lib/sdk/crt/math/i386/aullshr_asm.s index 1b9f2af9f2e..5d65f4b2eea 100644 --- a/reactos/lib/sdk/crt/math/i386/aullshr_asm.s +++ b/reactos/lib/sdk/crt/math/i386/aullshr_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __aullshr - -.intel_syntax noprefix +#include + +PUBLIC __aullshr + /* FUNCTIONS ***************************************************************/ +.code // // ullshr - long shift right @@ -65,13 +66,13 @@ __aullshr: // depends only on the high order bit of edx). // cmp cl,64 - jae short ..RETZERO + jae short .RETZERO // // Handle shifts of between 0 and 31 bits // cmp cl, 32 - jae short ..MORE32 + jae short .MORE32 shrd eax,edx,cl shr edx,cl ret @@ -79,7 +80,7 @@ __aullshr: // // Handle shifts of between 32 and 63 bits // -..MORE32: +.MORE32: mov eax,edx xor edx,edx and cl,31 @@ -89,7 +90,9 @@ __aullshr: // // return 0 in edx:eax // -..RETZERO: +.RETZERO: xor eax,eax xor edx,edx ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/ceil_asm.s b/reactos/lib/sdk/crt/math/i386/ceil_asm.s index aad69114f5a..0b6d2ffb7b3 100644 --- a/reactos/lib/sdk/crt/math/i386/ceil_asm.s +++ b/reactos/lib/sdk/crt/math/i386/ceil_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _ceil -.intel_syntax noprefix +#include + +PUBLIC _ceil /* FUNCTIONS ***************************************************************/ +.code _ceil: push ebp @@ -47,7 +48,7 @@ _ceil: fld qword ptr [ebp+8] // Load real from stack fstcw [ebp-2] // Save control word fclex // Clear exceptions - mov word ptr [ebp-4],0xb63 // Rounding control word + mov word ptr [ebp-4], HEX(0b63) // Rounding control word fldcw [ebp-4] // Set new rounding control frndint // Round to integer fclex // Clear exceptions @@ -55,3 +56,5 @@ _ceil: mov esp,ebp // Deallocate temporary space pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/ceilf.S b/reactos/lib/sdk/crt/math/i386/ceilf.S index 9eee272ecb3..79d66ce1cf2 100644 --- a/reactos/lib/sdk/crt/math/i386/ceilf.S +++ b/reactos/lib/sdk/crt/math/i386/ceilf.S @@ -3,53 +3,34 @@ * This file is part of the w64 mingw-runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <_mingw_mac.h> - .file "ceilf.S" - .text - .align 4 -.globl __MINGW_USYMBOL(ceilf) - .def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(ceilf): -#ifdef _WIN64 - subq $24,%rsp - movss %xmm0,8(%rsp) - flds 8(%rsp) +#include - fstcw 4(%rsp) /* store fpu control word */ +.code +.align 4 - movl $0x0800,%edx /* round towards +oo */ - orl 4(%rsp),%edx - andl $0xfbff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ +PUBLIC _ceilf +_ceilf: - frndint /* round */ + fld dword ptr [esp + 4] + sub esp, 8 - fldcw 4(%rsp) /* restore original control word */ - fstps 8(%rsp) - movss 8(%rsp),%xmm0 - addq $24,%rsp - ret -#else - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ + fstcw [esp + 4] /* store fpu control word */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ + mov edx, [esp + 4] + or edx, HEX(0800) /* round towards +oo */ + and edx, HEX(fbff) + mov [esp], edx + fldcw [esp] /* load modified control word */ frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldcw [esp + 4] /* restore original control word */ - addl $8,%esp + add esp, 8 ret -#endif + +END diff --git a/reactos/lib/sdk/crt/math/i386/cos_asm.s b/reactos/lib/sdk/crt/math/i386/cos_asm.s index b1c6ada49b2..7732fe78734 100644 --- a/reactos/lib/sdk/crt/math/i386/cos_asm.s +++ b/reactos/lib/sdk/crt/math/i386/cos_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _cos -.intel_syntax noprefix +#include + +PUBLIC _cos /* FUNCTIONS ***************************************************************/ +.code _cos: push ebp @@ -47,3 +48,5 @@ _cos: fcos // Take the cosine pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/exp_asm.s b/reactos/lib/sdk/crt/math/i386/exp_asm.s new file mode 100644 index 00000000000..3dd5be060b9 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/exp_asm.s @@ -0,0 +1,29 @@ + +#include + +PUBLIC _exp + +/* FUNCTIONS ***************************************************************/ +.code + +_exp: + push ebp + mov ebp, esp + + fld qword ptr [ebp + 8] + fldl2e + fmul st, st(1) + fst st(1) + frndint + fxch st(1) + fsub st, st(1) + f2xm1 + fld1 + faddp st(1), st + fscale + fstp st(1) + + pop ebp + ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/fabs_asm.s b/reactos/lib/sdk/crt/math/i386/fabs_asm.s index 5c6ce9214ef..c121f5205db 100644 --- a/reactos/lib/sdk/crt/math/i386/fabs_asm.s +++ b/reactos/lib/sdk/crt/math/i386/fabs_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _fabs - -.intel_syntax noprefix +#include + +PUBLIC _fabs + /* FUNCTIONS ***************************************************************/ +.code _fabs: push ebp @@ -47,3 +48,5 @@ _fabs: fabs // Take the absolute value pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/floor_asm.s b/reactos/lib/sdk/crt/math/i386/floor_asm.s index f03c85cb4e8..7a2ed174eb3 100644 --- a/reactos/lib/sdk/crt/math/i386/floor_asm.s +++ b/reactos/lib/sdk/crt/math/i386/floor_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _floor - -.intel_syntax noprefix +#include + +PUBLIC _floor + /* FUNCTIONS ***************************************************************/ +.code _floor: push ebp @@ -47,7 +48,7 @@ _floor: fld qword ptr [ebp+8] // Load real from stack fstcw [ebp-2] // Save control word fclex // Clear exceptions - mov word ptr [ebp-4],0x763 // Rounding control word + mov word ptr [ebp-4], HEX(0763) // Rounding control word fldcw [ebp-4] // Set new rounding control frndint // Round to integer fclex // Clear exceptions @@ -55,3 +56,5 @@ _floor: mov esp,ebp pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/floorf.S b/reactos/lib/sdk/crt/math/i386/floorf.S index eec073b2376..99ef5522038 100644 --- a/reactos/lib/sdk/crt/math/i386/floorf.S +++ b/reactos/lib/sdk/crt/math/i386/floorf.S @@ -7,57 +7,34 @@ * Removed header file dependency for use in libmingwex.a by * Danny Smith */ -#include <_mingw_mac.h> - .file "floorf.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(floorf) - .def __MINGW_USYMBOL(floorf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(floorf): -#ifdef _WIN64 - subq $24,%rsp - movss %xmm0,8(%rsp) - flds 8(%rsp) +#include - fstcw 4(%rsp) /* store fpu control word */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%rsp),%edx - andl $0xf7ff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ +.code +.align 4 - frndint /* round */ +PUBLIC _floorf +_floorf: - fldcw 4(%rsp) /* restore original control word */ + fld dword ptr [esp + 4] + sub esp, 8 - fstps 8(%rsp) - movss 8(%rsp),%xmm0 - addq $24,%rsp - ret -#else - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ + fstcw [esp + 4] /* store fpu control word */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ + mov edx, [esp + 4] + or edx, HEX(0400) /* round towards -oo */ + and edx, HEX(0f7ff) + mov [esp], edx + fldcw [esp] /* load modified control word */ frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldcw [esp + 4] /* restore original control word */ - addl $8,%esp + add esp, 8 ret -#endif + +END diff --git a/reactos/lib/sdk/crt/math/i386/fmod_asm.s b/reactos/lib/sdk/crt/math/i386/fmod_asm.s new file mode 100644 index 00000000000..44be4c0b24a --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/fmod_asm.s @@ -0,0 +1,26 @@ + +#include + +PUBLIC _fmod + +/* FUNCTIONS ***************************************************************/ +.code + +_fmod: + push ebp + mov ebp, esp + + fld qword ptr [ebp + 8] + fld qword ptr [ebp + 16] + fxch st(1) +l1: + fprem + fstsw ax + sahf + jp l1 + fstp st(1) + + pop ebp + ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/fmodf_asm.s b/reactos/lib/sdk/crt/math/i386/fmodf_asm.s new file mode 100644 index 00000000000..1a06ef98671 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/fmodf_asm.s @@ -0,0 +1,26 @@ + +#include + +PUBLIC _fmodf + +/* FUNCTIONS ***************************************************************/ +.code + +_fmodf: + push ebp + mov ebp, esp + + fld dword ptr [esp + 4] + fld dword ptr [esp + 8] + fxch st(1) +l1: + fprem + fstsw ax + sahf + jp l1 + fstp st(1) + + pop ebp + ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/ftol2_asm.s b/reactos/lib/sdk/crt/math/i386/ftol2_asm.s new file mode 100644 index 00000000000..12f55010312 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/ftol2_asm.s @@ -0,0 +1,28 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/ftol2.S + * PROGRAMER: + * + */ + +#include + +EXTERN __ftol:PROC +PUBLIC __ftol2 +PUBLIC __ftol2_sse + +/* FUNCTIONS ***************************************************************/ +.code + +/* + * This routine is called by MSVC-generated code to convert from floating point + * to integer representation. The floating point number to be converted is + * on the top of the floating point stack. + */ +__ftol2: +__ftol2_sse: + jmp __ftol + +END diff --git a/reactos/lib/sdk/crt/math/i386/ftol_asm.s b/reactos/lib/sdk/crt/math/i386/ftol_asm.s index 4e1445a9988..9942f389f88 100644 --- a/reactos/lib/sdk/crt/math/i386/ftol_asm.s +++ b/reactos/lib/sdk/crt/math/i386/ftol_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl __ftol - -.intel_syntax noprefix +#include + +PUBLIC __ftol + /* FUNCTIONS ***************************************************************/ +.code /* * This routine is called by MSVC-generated code to convert from floating point @@ -54,7 +55,7 @@ __ftol: fstcw [ebp-2] wait mov ax, [ebp-2] - or ah, 0xC + or ah, 12 mov [ebp-4], ax fldcw [ebp-4] @@ -71,3 +72,5 @@ __ftol: /* Remove stack frame and return*/ leave ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/log10_asm.s b/reactos/lib/sdk/crt/math/i386/log10_asm.s index 71731816429..a627ace1090 100644 --- a/reactos/lib/sdk/crt/math/i386/log10_asm.s +++ b/reactos/lib/sdk/crt/math/i386/log10_asm.s @@ -7,12 +7,13 @@ * PROGRAMER: Magnus Olsen (magnus@greatlord.com) * */ - -.globl _log10 -.intel_syntax noprefix +#include + +PUBLIC _log10 /* FUNCTIONS ***************************************************************/ +.code _log10: @@ -25,3 +26,4 @@ _log10: pop ebp ret +END diff --git a/reactos/lib/sdk/crt/math/i386/log_asm.s b/reactos/lib/sdk/crt/math/i386/log_asm.s index 0d98279ed41..472202fee92 100644 --- a/reactos/lib/sdk/crt/math/i386/log_asm.s +++ b/reactos/lib/sdk/crt/math/i386/log_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _log - -.intel_syntax noprefix +#include + +PUBLIC _log + /* FUNCTIONS ***************************************************************/ +.code _log: push ebp @@ -49,3 +50,5 @@ _log: fyl2x // Compute the natural log(x) pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/pow_asm.s b/reactos/lib/sdk/crt/math/i386/pow_asm.s index 0b79aa5883e..f418cd38c6e 100644 --- a/reactos/lib/sdk/crt/math/i386/pow_asm.s +++ b/reactos/lib/sdk/crt/math/i386/pow_asm.s @@ -19,41 +19,53 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -/* Reacros modifications */ +/* Reactos modifications */ +#include + #define ALIGNARG(log2) log2 #define ASM_TYPE_DIRECTIVE(name,typearg) #define ASM_SIZE_DIRECTIVE(name) #define cfi_adjust_cfa_offset(x) -#define ENTRY(x) -#define END(x) -.global _pow - .text +PUBLIC _pow + +.data +ASSUME nothing .align ALIGNARG(4) ASM_TYPE_DIRECTIVE(infinity,@object) + inf_zero: infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + .byte 0, 0, 0, 0, 0, 0, HEX(f0), HEX(7f) ASM_SIZE_DIRECTIVE(infinity) ASM_TYPE_DIRECTIVE(zero,@object) -zero: .double 0.0 +zero: + .double 0.0 ASM_SIZE_DIRECTIVE(zero) ASM_TYPE_DIRECTIVE(minf_mzero,@object) + minf_mzero: minfinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff + .byte 0, 0, 0, 0, 0, 0, HEX(f0), HEX(ff) + mzero: - .byte 0, 0, 0, 0, 0, 0, 0, 0x80 + .byte 0, 0, 0, 0, 0, 0, 0, HEX(80) ASM_SIZE_DIRECTIVE(minf_mzero) ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 + +one: + .double 1.0 ASM_SIZE_DIRECTIVE(one) ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 + +limit: + .double 0.29 ASM_SIZE_DIRECTIVE(limit) ASM_TYPE_DIRECTIVE(p63,@object) -p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 + +p63: + .byte 0, 0, 0, 0, 0, 0, HEX(e0), HEX(43) ASM_SIZE_DIRECTIVE(p63) #ifdef PIC @@ -61,308 +73,309 @@ p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 #define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else #define MO(op) op -#define MOX(op,x,f) op(,x,f) +#define MOX(op,x,f) op[x*f] #endif - .text +.code _pow: -ENTRY(__ieee754_pow) - fldl 12(%esp) // y + fld qword ptr [esp + 12] // y fxam #ifdef PIC LOAD_PIC_REG (cx) #endif - fnstsw - movb %ah, %dl - andb $0x45, %ah - cmpb $0x40, %ah // is y == 0 ? - je 11f + fnstsw ax + mov dl, ah + and ah, HEX(045) + cmp ah, HEX(040) // is y == 0 ? + je L11 - cmpb $0x05, %ah // is y == ±inf ? - je 12f + cmp ah, 5 // is y == ±inf ? + je L12 - cmpb $0x01, %ah // is y == NaN ? - je 30f + cmp ah, 1 // is y == NaN ? + je L30 - fldl 4(%esp) // x : y + fld qword ptr [esp + 4] // x : y - subl $8,%esp + sub esp, 8 cfi_adjust_cfa_offset (8) fxam - fnstsw - movb %ah, %dh - andb $0x45, %ah - cmpb $0x40, %ah - je 20f // x is ±0 + fnstsw ax + mov dh, ah + and ah, HEX(45) + cmp ah, HEX(040) + je L20 // x is ±0 - cmpb $0x05, %ah - je 15f // x is ±inf + cmp ah, 5 + je L15 // x is ±inf - fxch // y : x + fxch st(1) // y : x /* fistpll raises invalid exception for |y| >= 1L<<63. */ - fld %st // y : y : x + fld st // y : y : x fabs // |y| : y : x - fcompl MO(p63) // y : x - fnstsw + fcomp qword ptr MO(p63) // y : x + fnstsw ax sahf - jnc 2f + jnc L2 /* First see whether `y' is a natural number. In this case we can use a more precise algorithm. */ - fld %st // y : y : x - fistpll (%esp) // y : x - fildll (%esp) // int(y) : y : x - fucomp %st(1) // y : x - fnstsw + fld st // y : y : x + fistp qword ptr [esp] // y : x + fild qword ptr [esp] // int(y) : y : x + fucomp st(1) // y : x + fnstsw ax sahf - jne 2f + jne L2 /* OK, we have an integer value for y. */ - popl %eax + pop eax cfi_adjust_cfa_offset (-4) - popl %edx + pop edx cfi_adjust_cfa_offset (-4) - orl $0, %edx - fstp %st(0) // x - jns 4f // y >= 0, jump - fdivrl MO(one) // 1/x (now referred to as x) - negl %eax - adcl $0, %edx - negl %edx -4: fldl MO(one) // 1 : x - fxch + or edx, 0 + fstp st // x + jns L4 // y >= 0, jump + fdivr qword ptr MO(one) // 1/x (now referred to as x) + neg eax + adc edx, 0 + neg edx +L4: fld qword ptr MO(one) // 1 : x + fxch st(1) -6: shrdl $1, %edx, %eax - jnc 5f - fxch - fmul %st(1) // x : ST*x - fxch -5: fmul %st(0), %st // x*x : ST*x - shrl $1, %edx - movl %eax, %ecx - orl %edx, %ecx - jnz 6b - fstp %st(0) // ST*x +L6: shrd eax, edx, 1 + jnc L5 + fxch st(1) + fmul st, st(1) // x : ST*x + fxch st(1) +L5: fmul st, st // x*x : ST*x + shr edx, 1 + mov ecx, eax + or ecx, edx + jnz L6 + fstp st // ST*x ret /* y is ±NAN */ -30: fldl 4(%esp) // x : y - fldl MO(one) // 1.0 : x : y - fucomp %st(1) // x : y - fnstsw +L30: + fld qword ptr [esp + 4] // x : y + fld qword ptr MO(one) // 1.0 : x : y + fucomp st(1) // x : y + fnstsw ax sahf - je 31f - fxch // y : x -31: fstp %st(1) + je L31 + fxch st(1) // y : x +L31:fstp st(1) ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) -2: /* y is a real number. */ - fxch // x : y - fldl MO(one) // 1.0 : x : y - fldl MO(limit) // 0.29 : 1.0 : x : y - fld %st(2) // x : 0.29 : 1.0 : x : y - fsub %st(2) // x-1 : 0.29 : 1.0 : x : y +L2: /* y is a real number. */ + fxch st(1) // x : y + fld qword ptr MO(one) // 1.0 : x : y + fld qword ptr MO(limit) // 0.29 : 1.0 : x : y + fld st(2) // x : 0.29 : 1.0 : x : y + fsub st, st(2) // x-1 : 0.29 : 1.0 : x : y fabs // |x-1| : 0.29 : 1.0 : x : y fucompp // 1.0 : x : y - fnstsw - fxch // x : 1.0 : y + fnstsw ax + fxch st(1) // x : 1.0 : y sahf - ja 7f - fsub %st(1) // x-1 : 1.0 : y + ja L7 + fsub st, st(1) // x-1 : 1.0 : y fyl2xp1 // log2(x) : y - jmp 8f + jmp L8 -7: fyl2x // log2(x) : y -8: fmul %st(1) // y*log2(x) : y - fst %st(1) // y*log2(x) : y*log2(x) +L7: fyl2x // log2(x) : y +L8: fmul st, st(1) // y*log2(x) : y + fst st(1) // y*log2(x) : y*log2(x) frndint // int(y*log2(x)) : y*log2(x) - fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) + fsubr st(1), st // int(y*log2(x)) : fract(y*log2(x)) fxch // fract(y*log2(x)) : int(y*log2(x)) f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) - faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) + fadd qword ptr MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) - addl $8, %esp + add esp, 8 cfi_adjust_cfa_offset (-8) - fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) + fstp st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) ret // pow(x,±0) = 1 .align ALIGNARG(4) -11: fstp %st(0) // pop y - fldl MO(one) +L11:fstp st(0) // pop y + fld qword ptr MO(one) ret // y == ±inf .align ALIGNARG(4) -12: fstp %st(0) // pop y - fldl MO(one) // 1 - fldl 4(%esp) // x : 1 +L12: fstp st(0) // pop y + fld qword ptr MO(one) // 1 + fld qword ptr [esp + 4] // x : 1 fabs // abs(x) : 1 fucompp // < 1, == 1, or > 1 - fnstsw - andb $0x45, %ah - cmpb $0x45, %ah - je 13f // jump if x is NaN + fnstsw ax + and ah, HEX(45) + cmp ah, HEX(45) + je L13 // jump if x is NaN - cmpb $0x40, %ah - je 14f // jump if |x| == 1 + cmp ah, HEX(40) + je L14 // jump if |x| == 1 - shlb $1, %ah - xorb %ah, %dl - andl $2, %edx - fldl MOX(inf_zero, %edx, 4) + shl ah, 1 + xor dl, ah + and edx, 2 + fld qword ptr MOX(inf_zero, edx, 4) ret .align ALIGNARG(4) -14: fldl MO(one) +L14:fld qword ptr MO(one) ret .align ALIGNARG(4) -13: fldl 4(%esp) // load x == NaN +L13:fld qword ptr [esp + 4] // load x == NaN ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±inf -15: fstp %st(0) // y - testb $2, %dh - jz 16f // jump if x == +inf +L15: fstp st(0) // y + test dh, 2 + jz L16 // jump if x == +inf // We must find out whether y is an odd integer. - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y + fld st // y : y + fistp qword ptr [esp] // y + fild qword ptr [esp] // int(y) : y fucompp // - fnstsw + fnstsw ax sahf - jne 17f + jne L17 // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? - popl %eax + pop eax cfi_adjust_cfa_offset (-4) - popl %edx + pop edx cfi_adjust_cfa_offset (-4) - andb $1, %al - jz 18f // jump if not odd - movl %edx, %eax - orl %edx, %edx - jns 155f - negl %eax -155: cmpl $0x00200000, %eax - ja 18f // does not fit in mantissa bits + and al, 1 + jz L18 // jump if not odd + mov eax, edx + or edx, edx + jns L155 + neg eax +L155: + cmp eax, HEX(000200000) + ja L18 // does not fit in mantissa bits // It's an odd integer. - shrl $31, %edx - fldl MOX(minf_mzero, %edx, 8) + shr edx, 31 + fld qword ptr MOX(minf_mzero, edx, 8) ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) -16: fcompl MO(zero) - addl $8, %esp +L16:fcomp qword ptr MO(zero) + add esp, 8 cfi_adjust_cfa_offset (-8) - fnstsw - shrl $5, %eax - andl $8, %eax - fldl MOX(inf_zero, %eax, 1) + fnstsw ax + shr eax, 5 + and eax, 8 + fld qword ptr MOX(inf_zero, eax, 1) ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) -17: shll $30, %edx // sign bit for y in right position - addl $8, %esp +L17: shl ecx, 30 // sign bit for y in right position + add esp, 8 cfi_adjust_cfa_offset (-8) -18: shrl $31, %edx - fldl MOX(inf_zero, %edx, 8) +L18: shr edx, 31 + fld qword ptr MOX(inf_zero, edx, 8) ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 -20: fstp %st(0) // y - testb $2, %dl - jz 21f // y > 0 +L20: fstp st(0) // y + test dl, 2 + jz L21 // y > 0 // x is ±0 and y is < 0. We must find out whether y is an odd integer. - testb $2, %dh - jz 25f + test dh, 2 + jz L25 - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y + fld st // y : y + fistp qword ptr [esp] // y + fild qword ptr [esp] // int(y) : y fucompp // - fnstsw + fnstsw ax sahf - jne 26f + jne L26 // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? - popl %eax + pop eax cfi_adjust_cfa_offset (-4) - popl %edx + pop edx cfi_adjust_cfa_offset (-4) - andb $1, %al - jz 27f // jump if not odd - cmpl $0xffe00000, %edx - jbe 27f // does not fit in mantissa bits + and al, 1 + jz L27 // jump if not odd + cmp edx, HEX(0ffe00000) + jbe L27 // does not fit in mantissa bits // It's an odd integer. // Raise divide-by-zero exception and get minus infinity value. - fldl MO(one) - fdivl MO(zero) + fld qword ptr MO(one) + fdiv qword ptr MO(zero) fchs ret cfi_adjust_cfa_offset (8) -25: fstp %st(0) -26: addl $8, %esp +L25: fstp st(0) +L26: add esp, 8 cfi_adjust_cfa_offset (-8) -27: // Raise divide-by-zero exception and get infinity value. - fldl MO(one) - fdivl MO(zero) +L27: // Raise divide-by-zero exception and get infinity value. + fld qword ptr MO(one) + fdiv qword ptr MO(zero) ret cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 and y is > 0. We must find out whether y is an odd integer. -21: testb $2, %dh - jz 22f +L21:test dh, 2 + jz L22 - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y + fld st // y : y + fistp qword ptr [esp] // y + fild qword ptr [esp] // int(y) : y fucompp // - fnstsw + fnstsw ax sahf - jne 23f + jne L23 // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? - popl %eax + pop eax cfi_adjust_cfa_offset (-4) - popl %edx + pop edx cfi_adjust_cfa_offset (-4) - andb $1, %al - jz 24f // jump if not odd - cmpl $0xffe00000, %edx - jae 24f // does not fit in mantissa bits + and al, 1 + jz L24 // jump if not odd + cmp edx, HEX(0ffe00000) + jae L24 // does not fit in mantissa bits // It's an odd integer. - fldl MO(mzero) + fld qword ptr MO(mzero) ret cfi_adjust_cfa_offset (8) -22: fstp %st(0) -23: addl $8, %esp // Don't use 2 x pop +L22: fstp st(0) +L23: add esp, 8 // Don't use 2 x pop cfi_adjust_cfa_offset (-8) -24: fldl MO(zero) +L24: fld qword ptr MO(zero) ret -END(__ieee754_pow) +END diff --git a/reactos/lib/sdk/crt/math/i386/sin_asm.s b/reactos/lib/sdk/crt/math/i386/sin_asm.s index 39791a3e989..4a27af804b2 100644 --- a/reactos/lib/sdk/crt/math/i386/sin_asm.s +++ b/reactos/lib/sdk/crt/math/i386/sin_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _sin -.intel_syntax noprefix +#include + +PUBLIC _sin /* FUNCTIONS ***************************************************************/ +.code _sin: push ebp // Save register bp @@ -47,3 +48,5 @@ _sin: fsin // Take the sine pop ebp // Restore register bp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/sqrt_asm.s b/reactos/lib/sdk/crt/math/i386/sqrt_asm.s index c953a0350e9..3385204d572 100644 --- a/reactos/lib/sdk/crt/math/i386/sqrt_asm.s +++ b/reactos/lib/sdk/crt/math/i386/sqrt_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _sqrt - -.intel_syntax noprefix +#include + +PUBLIC _sqrt + /* FUNCTIONS ***************************************************************/ +.code _sqrt: push ebp @@ -47,3 +48,5 @@ _sqrt: fsqrt // Take the square root pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/math/i386/tan_asm.s b/reactos/lib/sdk/crt/math/i386/tan_asm.s index 34af2614f89..3b64b360f17 100644 --- a/reactos/lib/sdk/crt/math/i386/tan_asm.s +++ b/reactos/lib/sdk/crt/math/i386/tan_asm.s @@ -33,12 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _tan - -.intel_syntax noprefix +#include + +PUBLIC _tan + /* FUNCTIONS ***************************************************************/ +.code _tan: push ebp @@ -50,3 +51,5 @@ _tan: mov esp,ebp // Deallocate temporary space pop ebp ret + +END diff --git a/reactos/lib/sdk/crt/mem/i386/memchr_asm.s b/reactos/lib/sdk/crt/mem/i386/memchr_asm.s index f6e8037fc31..40cd3dc8cef 100644 --- a/reactos/lib/sdk/crt/mem/i386/memchr_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memchr_asm.s @@ -5,28 +5,34 @@ * FILE: lib/sdk/crt/mem/i386/memchr.s */ +#include +#include + /* * void* memchr(const void* s, int c, size_t n) */ -.globl _memchr +PUBLIC _memchr +.code _memchr: - push %ebp - mov %esp,%ebp - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%eax - mov 0x10(%ebp),%ecx + push ebp + mov ebp, esp + push edi + mov edi, [ebp + 8] + mov eax, [ebp + 12] + mov ecx, [ebp + 16] cld - jecxz .Lnotfound - repne scasb - je .Lfound + jecxz .Lnotfound + repne scasb + je .Lfound .Lnotfound: - mov $1,%edi + mov edi, 1 .Lfound: - mov %edi,%eax - dec %eax - pop %edi + mov eax, edi + dec eax + pop edi leave ret + +END diff --git a/reactos/lib/sdk/crt/mem/i386/memcpy_asm.s b/reactos/lib/sdk/crt/mem/i386/memcpy_asm.s index 36a1a079513..e69de29bb2d 100644 --- a/reactos/lib/sdk/crt/mem/i386/memcpy_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memcpy_asm.s @@ -1,114 +0,0 @@ -/* - * void *memcpy (void *to, const void *from, size_t count) - * - * NOTE: This code is a duplicate of memmove function from memmove_asm.s - */ - -.globl _memcpy - -_memcpy: - push %ebp - mov %esp,%ebp - - push %esi - push %edi - - mov 8(%ebp),%edi - mov 12(%ebp),%esi - mov 16(%ebp),%ecx - - cmp %esi,%edi - jbe .CopyUp - mov %ecx,%eax - add %esi,%eax - cmp %eax,%edi - jb .CopyDown - -.CopyUp: - cld - - cmp $16,%ecx - jb .L1 - mov %ecx,%edx - test $3,%edi - je .L2 -/* - * Make the destination dword aligned - */ - mov %edi,%ecx - and $3,%ecx - sub $5,%ecx - not %ecx - sub %ecx,%edx - rep movsb - mov %edx,%ecx -.L2: - shr $2,%ecx - rep movsl - mov %edx,%ecx - and $3,%ecx -.L1: - test %ecx,%ecx - je .L3 - rep movsb -.L3: - mov 8(%ebp),%eax - pop %edi - pop %esi - leave - ret - -.CopyDown: - std - - add %ecx,%edi - add %ecx,%esi - - cmp $16,%ecx - jb .L4 - mov %ecx,%edx - test $3,%edi - je .L5 - -/* - * Make the destination dword aligned - */ - mov %edi,%ecx - and $3,%ecx - sub %ecx,%edx - dec %esi - dec %edi - rep movsb - mov %edx,%ecx - - sub $3,%esi - sub $3,%edi -.L6: - shr $2,%ecx - rep movsl - mov %edx,%ecx - and $3,%ecx - je .L7 - add $3,%esi - add $3,%edi -.L8: - rep movsb -.L7: - cld - mov 8(%ebp),%eax - pop %edi - pop %esi - leave - ret -.L5: - sub $4,%edi - sub $4,%esi - jmp .L6 - -.L4: - test %ecx,%ecx - je .L7 - dec %esi - dec %edi - jmp .L8 - diff --git a/reactos/lib/sdk/crt/mem/i386/memmove_asm.s b/reactos/lib/sdk/crt/mem/i386/memmove_asm.s index e27006e3bed..476f843befe 100644 --- a/reactos/lib/sdk/crt/mem/i386/memmove_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memmove_asm.s @@ -1,114 +1,120 @@ /* - * void *memmove (void *to, const void *from, size_t count) + * void *memcpy (void *to, const void *from, size_t count) * - * NOTE: This code is duplicated in memcpy_asm.s */ -.globl _memmove +#include +#include +PUBLIC _memcpy +PUBLIC _memmove +.code + +_memcpy: _memmove: - push %ebp - mov %esp,%ebp + push ebp + mov ebp, esp - push %esi - push %edi + push esi + push edi - mov 8(%ebp),%edi - mov 12(%ebp),%esi - mov 16(%ebp),%ecx + mov edi, [ebp + 8] + mov esi, [ebp + 12] + mov ecx, [ebp + 16] - cmp %esi,%edi + cmp edi, esi jbe .CopyUp - mov %ecx,%eax - add %esi,%eax - cmp %eax,%edi - jb .CopyDown - + mov eax, ecx + add eax, esi + cmp edi, eax + jb .CopyDown + .CopyUp: cld - cmp $16,%ecx - jb .L1 - mov %ecx,%edx - test $3,%edi - je .L2 + cmp ecx, 16 + jb .L1 + mov edx, ecx + test edi, 3 + je .L2 /* * Make the destination dword aligned */ - mov %edi,%ecx - and $3,%ecx - sub $5,%ecx - not %ecx - sub %ecx,%edx - rep movsb - mov %edx,%ecx + mov ecx, edi + and ecx, 3 + sub ecx, 5 + not ecx + sub edx, ecx + rep movsb + mov ecx, edx .L2: - shr $2,%ecx - rep movsl - mov %edx,%ecx - and $3,%ecx + shr ecx, 2 + rep movsd + mov ecx, edx + and ecx, 3 .L1: - test %ecx,%ecx - je .L3 - rep movsb + test ecx, ecx + je .L3 + rep movsb .L3: - mov 8(%ebp),%eax - pop %edi - pop %esi + mov eax, [ebp + 8] + pop edi + pop esi leave ret .CopyDown: - std + std - add %ecx,%edi - add %ecx,%esi + add edi, ecx + add esi, ecx - cmp $16,%ecx - jb .L4 - mov %ecx,%edx - test $3,%edi - je .L5 + cmp ecx, 16 + jb .L4 + mov edx, ecx + test edi, 3 + je .L5 /* * Make the destination dword aligned */ - mov %edi,%ecx - and $3,%ecx - sub %ecx,%edx - dec %esi - dec %edi - rep movsb - mov %edx,%ecx + mov ecx, edi + and ecx, 3 + sub edx, ecx + dec esi + dec edi + rep movsb + mov ecx, edx - sub $3,%esi - sub $3,%edi + sub esi, 3 + sub edi, 3 .L6: - shr $2,%ecx - rep movsl - mov %edx,%ecx - and $3,%ecx - je .L7 - add $3,%esi - add $3,%edi + shr ecx, 2 + rep movsd + mov ecx, edx + and ecx, 3 + je .L7 + add esi, 3 + add edi, 3 .L8: - rep movsb + rep movsb .L7: cld - mov 8(%ebp),%eax - pop %edi - pop %esi + mov eax, [ebp + 8] + pop edi + pop esi leave ret .L5: - sub $4,%edi - sub $4,%esi - jmp .L6 - -.L4: - test %ecx,%ecx - je .L7 - dec %esi - dec %edi - jmp .L8 + sub edi, 4 + sub esi, 4 + jmp .L6 +.L4: + test ecx, ecx + je .L7 + dec esi + dec edi + jmp .L8 + +END diff --git a/reactos/lib/sdk/crt/mem/i386/memset_asm.s b/reactos/lib/sdk/crt/mem/i386/memset_asm.s index 4f7c9436e71..81430472f4a 100644 --- a/reactos/lib/sdk/crt/mem/i386/memset_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memset_asm.s @@ -2,46 +2,51 @@ * $Id$ */ +#include +#include + /* * void *memset (void *src, int val, size_t count) */ -.globl _memset +PUBLIC _memset +.code _memset: - push %ebp - mov %esp,%ebp - push %edi - mov 0x8(%ebp),%edi - movzb 0xc(%ebp),%eax - mov 0x10(%ebp),%ecx + push ebp + mov ebp, esp + push edi + mov edi, [ebp + 8] + movzx eax, byte ptr [ebp + 12] + mov ecx, [ebp + 16] cld - cmp $16,%ecx - jb .L1 - mov $0x01010101,%edx - mul %edx - mov %ecx,%edx - test $3,%edi - je .L2 - mov %edi,%ecx - and $3,%ecx - sub $5,%ecx - not %ecx - sub %ecx,%edx - rep stosb - mov %edx,%ecx + cmp ecx, 16 + jb .L1 + mov edx, HEX(01010101) + mul edx + mov edx, ecx + test edi, 3 + je .L2 + mov ecx, edi + and ecx, 3 + sub ecx, 5 + not ecx + sub edx, ecx + rep stosb + mov ecx, edx .L2: - shr $2,%ecx - rep stosl - mov %edx,%ecx - and $3,%ecx + shr ecx, 2 + rep stosd + mov ecx, edx + and ecx, 3 .L1: - test %ecx,%ecx - je .L3 - rep stosb + test ecx, ecx + je .L3 + rep stosb .L3: - pop %edi - mov 0x8(%ebp),%eax + pop edi + mov eax, [ebp + 8] leave ret +END diff --git a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s index 56459ae7665..a969bc43db5 100644 --- a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include #define JUMP_BUFFER_Frame 0x00 #define JUMP_BUFFER_Rbx 0x08 @@ -156,3 +156,5 @@ PUBLIC longjmp inc rax 2: jmp r8 .endp longjmp + +END diff --git a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s index 7cf257cca24..dc0e9656b3a 100644 --- a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s @@ -9,6 +9,8 @@ * complete implementation */ +#include + #define JB_BP 0 #define JB_BX 1 #define JB_DI 2 @@ -20,6 +22,7 @@ #define JMPBUF 4 +.code /* * int * _setjmp(jmp_buf env); @@ -33,20 +36,20 @@ * Notes: * Sets up the jmp_buf */ -.globl __setjmp +PUBLIC __setjmp __setjmp: - xorl %eax, %eax - movl JMPBUF(%esp), %edx + xor eax, eax + mov edx, JMPBUF[esp] /* Save registers. */ - movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ - movl %ebx, (JB_BX*4)(%edx) - movl %edi, (JB_DI*4)(%edx) - movl %esi, (JB_SI*4)(%edx) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%edx) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_IP*4)(%edx) + mov [edx + JB_BP*4], ebp /* Save caller's frame pointer. */ + mov [edx + JB_BX*4], ebx + mov [edx + JB_DI*4], edi + mov [edx + JB_SI*4], esi + lea ecx, JMPBUF[esp] /* Save SP as it will be after we return. */ + mov [edx + JB_SP*4], ecx + mov ecx, PCOFF[esp] /* Save PC we are returning to now. */ + mov [edx + JB_IP*4], ecx ret /* @@ -62,24 +65,22 @@ __setjmp: * Notes: * Sets up the jmp_buf */ -.globl __setjmp3 +PUBLIC __setjmp3 __setjmp3: - xorl %eax, %eax - movl JMPBUF(%esp), %edx + xor eax, eax + mov edx, JMPBUF[esp] /* Save registers. */ - movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ - movl %ebx, (JB_BX*4)(%edx) - movl %edi, (JB_DI*4)(%edx) - movl %esi, (JB_SI*4)(%edx) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%edx) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_IP*4)(%edx) + mov [edx + JB_BP*4], ebp /* Save caller's frame pointer. */ + mov [edx + JB_BX*4], ebx + mov [edx + JB_DI*4], edi + mov [edx + JB_SI*4], esi + lea ecx, JMPBUF[esp] /* Save SP as it will be after we return. */ + mov [edx + JB_SP*4], ecx + mov ecx, PCOFF[esp] /* Save PC we are returning to now. */ + mov [edx + JB_IP*4], ecx ret -#define VAL 8 - /* * void * longjmp(jmp_buf env, int value); @@ -94,18 +95,20 @@ __setjmp3: * Notes: * Non-local goto */ -.globl _longjmp +PUBLIC _longjmp _longjmp: - movl JMPBUF(%esp), %ecx /* User's jmp_buf in %ecx. */ + mov ecx, JMPBUF[esp] /* User's jmp_buf in %ecx. */ - movl VAL(%esp), %eax /* Second argument is return value. */ + mov eax, [esp + 8] /* Second argument is return value. */ /* Save the return address now. */ - movl (JB_IP*4)(%ecx), %edx + mov edx, [edx + JB_IP*4] /* Restore registers. */ - movl (JB_BP*4)(%ecx), %ebp - movl (JB_BX*4)(%ecx), %ebx - movl (JB_DI*4)(%ecx), %edi - movl (JB_SI*4)(%ecx), %esi - movl (JB_SP*4)(%ecx), %esp + mov ebp, [edx + JB_BP*4] + mov ebx, [edx + JB_BX*4] + mov edi, [edx + JB_DI*4] + mov esi, [edx + JB_SI*4] + mov esp, [edx + JB_SP*4] /* Jump to saved PC. */ - jmp *%edx + jmp dword ptr [edx] + +END diff --git a/reactos/lib/sdk/crt/string/i386/strcat_asm.s b/reactos/lib/sdk/crt/string/i386/strcat_asm.s index 1241e78f7bb..6f7b8052d23 100644 --- a/reactos/lib/sdk/crt/string/i386/strcat_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strcat_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcscat.h" +#include "tcscat.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strchr_asm.s b/reactos/lib/sdk/crt/string/i386/strchr_asm.s index b90e86d3303..f8085f25485 100644 --- a/reactos/lib/sdk/crt/string/i386/strchr_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strchr_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcschr.h" +#include "tcschr.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strcmp_asm.s b/reactos/lib/sdk/crt/string/i386/strcmp_asm.s index 3ee6573f700..8618f17c076 100644 --- a/reactos/lib/sdk/crt/string/i386/strcmp_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strcmp_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcscmp.h" +#include "tcscmp.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strcpy_asm.s b/reactos/lib/sdk/crt/string/i386/strcpy_asm.s index 1b77403847c..168d2921ba8 100644 --- a/reactos/lib/sdk/crt/string/i386/strcpy_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strcpy_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcscpy.h" +#include "tcscpy.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strlen_asm.s b/reactos/lib/sdk/crt/string/i386/strlen_asm.s index 9bb10b6d91b..66a8ba27299 100644 --- a/reactos/lib/sdk/crt/string/i386/strlen_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strlen_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcslen.h" +#include "tcslen.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strncat_asm.s b/reactos/lib/sdk/crt/string/i386/strncat_asm.s index 52b20671625..d7fefe417a7 100644 --- a/reactos/lib/sdk/crt/string/i386/strncat_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strncat_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcsncat.h" +#include "tcsncat.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strncmp_asm.s b/reactos/lib/sdk/crt/string/i386/strncmp_asm.s index 30c64e6b664..d4db767c207 100644 --- a/reactos/lib/sdk/crt/string/i386/strncmp_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strncmp_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcsncmp.h" +#include "tcsncmp.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strncpy_asm.s b/reactos/lib/sdk/crt/string/i386/strncpy_asm.s index 7409b4ed6c7..584dbb8cce5 100644 --- a/reactos/lib/sdk/crt/string/i386/strncpy_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strncpy_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcsncpy.h" +#include "tcsncpy.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strnlen_asm.s b/reactos/lib/sdk/crt/string/i386/strnlen_asm.s index be35b3ca2c2..5c1f8dfccf7 100644 --- a/reactos/lib/sdk/crt/string/i386/strnlen_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strnlen_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcsnlen.h" +#include "tcsnlen.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/strrchr_asm.s b/reactos/lib/sdk/crt/string/i386/strrchr_asm.s index a8a9d5e79ac..c94f29ec0d7 100644 --- a/reactos/lib/sdk/crt/string/i386/strrchr_asm.s +++ b/reactos/lib/sdk/crt/string/i386/strrchr_asm.s @@ -1,6 +1,6 @@ /* $Id$ */ -#include "tcsrchr.h" +#include "tcsrchr.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tchar.h b/reactos/lib/sdk/crt/string/i386/tchar.h index ce2f1b9666d..a313e86111e 100644 --- a/reactos/lib/sdk/crt/string/i386/tchar.h +++ b/reactos/lib/sdk/crt/string/i386/tchar.h @@ -21,12 +21,12 @@ #define _tlods lodsw #define _tstos stosw -#define _tsize $2 +#define _tsize 2 #define _treg(_O_) _O_ ## x -#define _tdec(_O_) sub $2, _O_ -#define _tinc(_O_) add $2, _O_ +#define _tdec(_O_) sub _O_, 2 +#define _tinc(_O_) add _O_, 2 #else @@ -45,7 +45,7 @@ #define _tlods lodsb #define _tstos stosb -#define _tsize $1 +#define _tsize 1 #define _treg(_O_) _O_ ## l diff --git a/reactos/lib/sdk/crt/string/i386/tcscat.h b/reactos/lib/sdk/crt/string/i386/tcscat.h deleted file mode 100644 index e50676528d8..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcscat.h +++ /dev/null @@ -1,32 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcscat - -_tcscat: - push %esi - push %edi - mov 0x0C(%esp), %edi - mov 0x10(%esp), %esi - - xor %eax, %eax - mov $-1, %ecx - cld - - repne _tscas - _tdec(%edi) - -.L1: - _tlods - _tstos - test %_treg(a), %_treg(a) - jnz .L1 - - mov 0x0C(%esp), %eax - pop %edi - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscat.inc b/reactos/lib/sdk/crt/string/i386/tcscat.inc new file mode 100644 index 00000000000..d587128f447 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcscat.inc @@ -0,0 +1,35 @@ +/* $Id: tcscat.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcscat +.code + +_tcscat: + push esi + push edi + mov edi, [esp + 12] + mov esi, [esp + 16] + + xor eax, eax + mov ecx, -1 + cld + + repne _tscas + _tdec(edi) + +.L1: + _tlods + _tstos + test _treg(a), _treg(a) + jnz .L1 + + mov eax, [esp + 12] + pop edi + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcschr.h b/reactos/lib/sdk/crt/string/i386/tcschr.h deleted file mode 100644 index ea08bb8d22e..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcschr.h +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcschr - -_tcschr: - push %esi - mov 0x8(%esp), %esi - mov 0xC(%esp), %edx - - cld - -.L1: - _tlods - cmp %_treg(a), %_treg(d) - je .L2 - test %_treg(a), %_treg(a) - jnz .L1 - mov _tsize, %esi - -.L2: - mov %esi, %eax - _tdec(%eax) - - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcschr.inc b/reactos/lib/sdk/crt/string/i386/tcschr.inc new file mode 100644 index 00000000000..9554ac3cbcd --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcschr.inc @@ -0,0 +1,32 @@ +/* $Id: tcschr.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcschr +.code + +_tcschr: + push esi + mov esi, [esp + 8] + mov edx, [esp + 12] + cld + +.L1: + _tlods + cmp _treg(d), _treg(a) + je .L2 + test _treg(a), _treg(a) + jnz .L1 + mov esi, _tsize + +.L2: + mov eax, esi + _tdec(eax) + + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscmp.h b/reactos/lib/sdk/crt/string/i386/tcscmp.h deleted file mode 100644 index 6830a0ba0dc..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcscmp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcscmp - -_tcscmp: - push %esi - push %edi - mov 0x0C(%esp), %esi - mov 0x10(%esp), %edi - xor %eax, %eax - cld - -.L1: - _tlods - _tscas - jne .L2 - test %eax, %eax - jne .L1 - xor %eax, %eax - jmp .L3 - -.L2: - sbb %eax, %eax - or $1, %al - -.L3: - pop %edi - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscmp.inc b/reactos/lib/sdk/crt/string/i386/tcscmp.inc new file mode 100644 index 00000000000..3bcf453e7b7 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcscmp.inc @@ -0,0 +1,37 @@ +/* $Id: tcscmp.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcscmp +.code + +_tcscmp: + push esi + push edi + mov esi, [esp + 12] + mov edi, [esp + 16] + xor eax, eax + cld + +.L1: + _tlods + _tscas + jne .L2 + test eax, eax + jne .L1 + xor eax, eax + jmp .L3 + +.L2: + sbb eax, eax + or al, 1 + +.L3: + pop edi + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscpy.h b/reactos/lib/sdk/crt/string/i386/tcscpy.h deleted file mode 100644 index cb89a43a4a8..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcscpy.h +++ /dev/null @@ -1,27 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcscpy - -_tcscpy: - push %esi - push %edi - mov 0x0C(%esp), %edi - mov 0x10(%esp), %esi - cld - -.L1: - _tlods - _tstos - test %_treg(a), %_treg(a) - jnz .L1 - - mov 0x0C(%esp), %eax - - pop %edi - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscpy.inc b/reactos/lib/sdk/crt/string/i386/tcscpy.inc new file mode 100644 index 00000000000..b16b4ccea32 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcscpy.inc @@ -0,0 +1,30 @@ +/* $Id: tcscpy.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcscpy +.code + +_tcscpy: + push esi + push edi + mov edi, [esp + 12] + mov esi, [esp + 16] + cld + +.L1: + _tlods + _tstos + test _treg(a), _treg(a) + jnz .L1 + + mov eax, [esp + 12] + + pop edi + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcslen.h b/reactos/lib/sdk/crt/string/i386/tcslen.h deleted file mode 100644 index 8c9586da70d..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcslen.h +++ /dev/null @@ -1,29 +0,0 @@ -/* $Id$ -*/ - -#include "tchar.h" - -.globl _tcslen - -_tcslen: - push %edi - mov 0x8(%esp), %edi - xor %eax, %eax - test %edi,%edi - jz _tcslen_end - - mov $-1, %ecx - cld - - repne _tscas - - not %ecx - dec %ecx - - mov %ecx, %eax - -_tcslen_end: - pop %edi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcslen.inc b/reactos/lib/sdk/crt/string/i386/tcslen.inc new file mode 100644 index 00000000000..f749b9d88c4 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcslen.inc @@ -0,0 +1,32 @@ +/* $Id: tcslen.inc 49591 2010-11-15 01:29:12Z tkreuzer $ +*/ + +#include "tchar.h" +#include + +PUBLIC _tcslen +.code + +_tcslen: + push edi + mov edi, [esp + 8] + xor eax, eax + test edi, edi + jz _tcslen_end + + mov ecx, -1 + cld + + repne _tscas + + not ecx + dec ecx + + mov eax, ecx + +_tcslen_end: + pop edi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncat.h b/reactos/lib/sdk/crt/string/i386/tcsncat.h deleted file mode 100644 index f7a3b616396..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcsncat.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcsncat - -_tcsncat: - push %esi - push %edi - mov 0x0C(%esp), %edi - mov 0x10(%esp), %esi - cld - - xor %eax, %eax - mov $-1, %ecx - repne _tscas - _tdec(%edi) - - mov 0x14(%esp),%ecx - -.L1: - dec %ecx - js .L2 - _tlods - _tstos - test %_treg(a), %_treg(a) - jne .L1 - jmp .L3 - -.L2: - xor %eax, %eax - _tstos - -.L3: - mov 0x0C(%esp), %eax - pop %edi - pop %esi - - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncat.inc b/reactos/lib/sdk/crt/string/i386/tcsncat.inc new file mode 100644 index 00000000000..b03bb87785f --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcsncat.inc @@ -0,0 +1,45 @@ +/* $Id: tcsncat.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcsncat +.code + +_tcsncat: + push esi + push edi + mov edi, [esp + 12] + mov esi, [esp + 16] + cld + + xor eax, eax + mov ecx, -1 + repne _tscas + _tdec(edi) + + mov ecx, [esp + 20] + +.L1: + dec ecx + js .L2 + _tlods + _tstos + test _treg(a), _treg(a) + jne .L1 + jmp .L3 + +.L2: + xor eax, eax + _tstos + +.L3: + mov eax, [esp + 12] + pop edi + pop esi + + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncmp.h b/reactos/lib/sdk/crt/string/i386/tcsncmp.h deleted file mode 100644 index 58a30859e73..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcsncmp.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcsncmp - -_tcsncmp: - push %esi - push %edi - mov 0x0C(%esp), %esi /* s1 */ - mov 0x10(%esp), %edi /* s2 */ - mov 0x14(%esp), %ecx /* n */ - - xor %eax,%eax - cld - -.L1: - dec %ecx - js .L2 - _tlods - _tscas - jne .L3 - test %eax, %eax - jne .L1 - -.L2: - xor %eax, %eax - jmp .L4 - -.L3: - sbb %eax, %eax - or $1, %al - -.L4: - pop %edi - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncmp.inc b/reactos/lib/sdk/crt/string/i386/tcsncmp.inc new file mode 100644 index 00000000000..9545e583bec --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcsncmp.inc @@ -0,0 +1,43 @@ +/* $Id: tcsncmp.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcsncmp +.code + +_tcsncmp: + push esi + push edi + mov esi, [esp + 12] /* s1 */ + mov edi, [esp + 16] /* s2 */ + mov ecx, [esp + 20] /* n */ + + xor eax, eax + cld + +.L1: + dec ecx + js .L2 + _tlods + _tscas + jne .L3 + test eax, eax + jne .L1 + +.L2: + xor eax, eax + jmp .L4 + +.L3: + sbb eax, eax + or al, 1 + +.L4: + pop edi + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncpy.h b/reactos/lib/sdk/crt/string/i386/tcsncpy.h deleted file mode 100644 index ed15334d036..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcsncpy.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcsncpy - -_tcsncpy: - push %esi - push %edi - mov 0x0C(%esp), %edi /* s1 */ - mov 0x10(%esp), %esi /* s2 */ - mov 0x14(%esp), %ecx /* n */ - - xor %eax, %eax - cld - -.L1: - dec %ecx - js .L2 - _tlods - _tstos - test %_treg(a), %_treg(a) - jnz .L1 - rep _tstos - -.L2: - mov 0x0C(%esp), %eax - - pop %edi - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncpy.inc b/reactos/lib/sdk/crt/string/i386/tcsncpy.inc new file mode 100644 index 00000000000..248c5ce9a20 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcsncpy.inc @@ -0,0 +1,37 @@ +/* $Id: tcsncpy.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcsncpy +.code + +_tcsncpy: + push esi + push edi + mov edi, [esp + 12] /* s1 */ + mov esi, [esp + 16] /* s2 */ + mov ecx, [esp + 20] /* n */ + + xor eax, eax + cld + +.L1: + dec ecx + js .L2 + _tlods + _tstos + test _treg(a), _treg(a) + jnz .L1 + rep _tstos + +.L2: + mov eax, [esp + 12] + + pop edi + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsnlen.h b/reactos/lib/sdk/crt/string/i386/tcsnlen.h deleted file mode 100644 index 90a4ec6c88c..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcsnlen.h +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id$ -*/ - -#include "tchar.h" - -.globl _tcsnlen - -_tcsnlen: - push %edi - mov 0x8(%esp), %edi - mov 0xC(%esp), %ecx - xor %eax, %eax - test %ecx, %ecx - jz .L1 - mov %ecx, %edx - - cld - - repne _tscas - - sete %al - sub %ecx, %edx - sub %eax, %edx - mov %edx, %eax - -.L1: - pop %edi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsnlen.inc b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc new file mode 100644 index 00000000000..fc72607adb2 --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc @@ -0,0 +1,33 @@ +/* $Id: tcsnlen.inc 49591 2010-11-15 01:29:12Z tkreuzer $ +*/ + +#include "tchar.h" +#include + +PUBLIC _tcsnlen +.code + +_tcsnlen: + push edi + mov edi, [esp + 8] + mov ecx, [esp + 12] + xor eax, eax + test ecx, ecx + jz .L1 + mov edx, ecx + + cld + + repne _tscas + + sete al + sub edx, ecx + sub edx, eax + mov eax, edx + +.L1: + pop edi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsrchr.h b/reactos/lib/sdk/crt/string/i386/tcsrchr.h deleted file mode 100644 index 61d3a4dd863..00000000000 --- a/reactos/lib/sdk/crt/string/i386/tcsrchr.h +++ /dev/null @@ -1,31 +0,0 @@ -/* $Id$ - */ - -#include "tchar.h" - -.globl _tcsrchr - -_tcsrchr: - push %esi - mov 0x8(%esp), %esi - mov 0xC(%esp), %edx - - cld - mov _tsize, %ecx - -.L1: - _tlods - cmp %_treg(a), %_treg(d) - jne .L2 - mov %esi, %ecx - -.L2: - test %_treg(a), %_treg(a) - jnz .L1 - - mov %ecx, %eax - _tdec(%eax) - pop %esi - ret - -/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsrchr.inc b/reactos/lib/sdk/crt/string/i386/tcsrchr.inc new file mode 100644 index 00000000000..9527853122a --- /dev/null +++ b/reactos/lib/sdk/crt/string/i386/tcsrchr.inc @@ -0,0 +1,34 @@ +/* $Id: tcsrchr.inc 49591 2010-11-15 01:29:12Z tkreuzer $ + */ + +#include "tchar.h" +#include + +PUBLIC _tcsrchr +.code + +_tcsrchr: + push esi + mov esi, [esp + 8] + mov edx, [esp + 12] + + cld + mov ecx, _tsize + +.L1: + _tlods + cmp _treg(d), _treg(a) + jne .L2 + mov ecx, esi + +.L2: + test _treg(a), _treg(a) + jnz .L1 + + mov eax, ecx + _tdec(eax) + pop esi + ret + +END +/* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcscat_asm.s b/reactos/lib/sdk/crt/string/i386/wcscat_asm.s index 56beb026aa3..b833d0ddab3 100644 --- a/reactos/lib/sdk/crt/string/i386/wcscat_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcscat_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcscat.h" +#include "tcscat.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcschr_asm.s b/reactos/lib/sdk/crt/string/i386/wcschr_asm.s index a493a48d237..8fc6c360baf 100644 --- a/reactos/lib/sdk/crt/string/i386/wcschr_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcschr_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcschr.h" +#include "tcschr.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcscmp_asm.s b/reactos/lib/sdk/crt/string/i386/wcscmp_asm.s index 2377a026b78..b4f5425beba 100644 --- a/reactos/lib/sdk/crt/string/i386/wcscmp_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcscmp_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcscmp.h" +#include "tcscmp.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcscpy_asm.s b/reactos/lib/sdk/crt/string/i386/wcscpy_asm.s index 7e76864972d..78b6fe2a6d2 100644 --- a/reactos/lib/sdk/crt/string/i386/wcscpy_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcscpy_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcscpy.h" +#include "tcscpy.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcslen_asm.s b/reactos/lib/sdk/crt/string/i386/wcslen_asm.s index f70390048ad..5d4bfe054aa 100644 --- a/reactos/lib/sdk/crt/string/i386/wcslen_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcslen_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcslen.h" +#include "tcslen.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcsncat_asm.s b/reactos/lib/sdk/crt/string/i386/wcsncat_asm.s index 36e2cf15dc6..d28bbc3e3a4 100644 --- a/reactos/lib/sdk/crt/string/i386/wcsncat_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcsncat_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcsncat.h" +#include "tcsncat.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcsncmp_asm.s b/reactos/lib/sdk/crt/string/i386/wcsncmp_asm.s index 594e2c49340..5ae53efa7c9 100644 --- a/reactos/lib/sdk/crt/string/i386/wcsncmp_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcsncmp_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcsncmp.h" +#include "tcsncmp.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcsncpy_asm.s b/reactos/lib/sdk/crt/string/i386/wcsncpy_asm.s index 601e70cdafe..b4591cfdb10 100644 --- a/reactos/lib/sdk/crt/string/i386/wcsncpy_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcsncpy_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcsncpy.h" +#include "tcsncpy.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcsnlen_asm.s b/reactos/lib/sdk/crt/string/i386/wcsnlen_asm.s index 65bd605231c..39349927757 100644 --- a/reactos/lib/sdk/crt/string/i386/wcsnlen_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcsnlen_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcsnlen.h" +#include "tcsnlen.inc" /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/wcsrchr_asm.s b/reactos/lib/sdk/crt/string/i386/wcsrchr_asm.s index 872403a8956..a845ee53203 100644 --- a/reactos/lib/sdk/crt/string/i386/wcsrchr_asm.s +++ b/reactos/lib/sdk/crt/string/i386/wcsrchr_asm.s @@ -2,6 +2,6 @@ */ #define _UNICODE -#include "tcsrchr.h" +#include "tcsrchr.inc" /* EOF */ diff --git a/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S b/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S index f09edfd3b9c..566f37f5a0c 100644 --- a/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S +++ b/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S @@ -8,14 +8,13 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include #include /* FUNCTIONS ****************************************************************/ .code32 -.text /* * NOTE: These functions must obey the following rules: @@ -30,7 +29,7 @@ *ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend, * IN ULONG Increment) */ -.global @ExInterlockedAddLargeStatistic@8 +PUBLIC @ExInterlockedAddLargeStatistic@8 @ExInterlockedAddLargeStatistic@8: #ifdef CONFIG_SMP @@ -38,10 +37,10 @@ lock add [ecx], edx /* Check for carry bit and return */ - jb 1f + jb .l1 ret -1: +.l1: /* Add carry */ lock adc dword ptr [ecx+4], 0 #else @@ -58,7 +57,7 @@ * IN ULONG Increment, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedAddUlong@12 +PUBLIC @ExfInterlockedAddUlong@12 @ExfInterlockedAddUlong@12: /* Save flags */ @@ -103,7 +102,7 @@ * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedInsertHeadList@12 +PUBLIC @ExfInterlockedInsertHeadList@12 @ExfInterlockedInsertHeadList@12: #ifdef CONFIG_SMP @@ -139,11 +138,11 @@ /* Check if list was empty */ xor eax, ecx - jz 2f + jz .l2 /* Return list pointer */ xor eax, ecx -2: +.l2: ret 4 #ifdef CONFIG_SMP @@ -159,7 +158,7 @@ * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedInsertTailList@12 +PUBLIC @ExfInterlockedInsertTailList@12 @ExfInterlockedInsertTailList@12: #ifdef CONFIG_SMP @@ -195,11 +194,11 @@ /* Check if list was empty */ xor eax, ecx - jz 2f + jz .l3 /* Return list pointer */ xor eax, ecx -2: +.l3: ret 4 #ifdef CONFIG_SMP @@ -214,7 +213,7 @@ *ExfInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedRemoveHeadList@8 +PUBLIC @ExfInterlockedRemoveHeadList@8 @ExfInterlockedRemoveHeadList@8: /* Save flags and disable interrupts */ @@ -228,7 +227,7 @@ /* Check if it's empty */ cmp eax, ecx - je 2f + je .l4 /* Get the next entry and do the deletion */ #ifdef CONFIG_SMP @@ -254,7 +253,7 @@ /* Return */ ret -2: +.l4: /* Release lock */ RELEASE_SPINLOCK(edx) @@ -276,7 +275,7 @@ *ExfInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedPopEntryList@8 +PUBLIC @ExfInterlockedPopEntryList@8 @ExfInterlockedPopEntryList@8: /* Save flags and disable interrupts */ @@ -290,7 +289,7 @@ /* Check if it's empty */ or eax, eax - je 3f + je .l6 /* Get next entry and do deletion */ #ifdef CONFIG_SMP @@ -302,7 +301,7 @@ pop edx #endif -2: +.l5: /* Release lock */ RELEASE_SPINLOCK(edx) @@ -312,10 +311,10 @@ /* Return */ ret -3: +.l6: /* Return empty list */ xor eax, eax - jmp 2b + jmp .l5 #ifdef CONFIG_SMP .spin5: @@ -329,7 +328,7 @@ * IN PSINGLE_LIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedPushEntryList@12 +PUBLIC @ExfInterlockedPushEntryList@12 @ExfInterlockedPushEntryList@12: /* Save flags */ @@ -383,11 +382,11 @@ *ExInterlockedPopEntrySList(IN PSINGLE_LIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global @ExInterlockedPopEntrySList@8 -.global @InterlockedPopEntrySList@4 -.global _ExpInterlockedPopEntrySListResume@0 -.global _ExpInterlockedPopEntrySListFault@0 -.global _ExpInterlockedPopEntrySListEnd@0 +PUBLIC @ExInterlockedPopEntrySList@8 +PUBLIC @InterlockedPopEntrySList@4 +PUBLIC _ExpInterlockedPopEntrySListResume@0 +PUBLIC _ExpInterlockedPopEntrySListFault@0 +PUBLIC _ExpInterlockedPopEntrySListEnd@0 @ExInterlockedPopEntrySList@8: @InterlockedPopEntrySList@4: @@ -405,7 +404,7 @@ _ExpInterlockedPopEntrySListResume@0: /* Check if the list is empty */ or eax, eax - jz 2f + jz .l7 /* Copy sequence number and adjust it */ lea ecx, [edx-1] @@ -418,7 +417,7 @@ _ExpInterlockedPopEntrySListEnd@0: jnz _ExpInterlockedPopEntrySListResume@0 /* Restore registers and return */ -2: +.l7: pop ebp pop ebx ret @@ -429,13 +428,13 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PSINGLE_LIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global @ExInterlockedPushEntrySList@12 +PUBLIC @ExInterlockedPushEntrySList@12 @ExInterlockedPushEntrySList@12: /* So we can fall through below */ pop [esp] -.global @InterlockedPushEntrySList@8 +PUBLIC @InterlockedPushEntrySList@8 @InterlockedPushEntrySList@8: /* Save registers */ @@ -450,19 +449,18 @@ _ExpInterlockedPopEntrySListEnd@0: mov edx, [ebp+4] mov eax, [ebp] -1: +.l8: /* Set link pointer */ mov [ebx], eax /* Copy sequence number and adjust it */ - lea ecx, [edx+0x10001] + lea ecx, [edx + HEX(10001)] /* Do the exchange */ LOCK cmpxchg8b qword ptr [ebp] - jnz 1b + jnz .l8 /* Restore registers and return */ -2: pop ebp pop ebx ret @@ -471,7 +469,7 @@ _ExpInterlockedPopEntrySListEnd@0: *FASTCALL *ExInterlockedFlushSList(IN PSINGLE_LIST_ENTRY ListHead) */ -.global @ExInterlockedFlushSList@4 +PUBLIC @ExInterlockedFlushSList@4 @ExInterlockedFlushSList@4: /* Save registers */ @@ -488,10 +486,10 @@ _ExpInterlockedPopEntrySListEnd@0: mov edx, [ebp+4] mov eax, [ebp] -1: +.l9: /* Check if the list is empty */ or eax, eax - jz 2f + jz .l10 /* Clear sequence and pointer */ mov ecx, edx @@ -499,10 +497,10 @@ _ExpInterlockedPopEntrySListEnd@0: /* Do the exchange */ LOCK cmpxchg8b qword ptr [ebp] - jnz 1b + jnz .l9 /* Restore registers and return */ -2: +.l10: pop ebp pop ebx ret @@ -511,7 +509,7 @@ _ExpInterlockedPopEntrySListEnd@0: *FASTCALL *Exfi386InterlockedIncrementLong(IN PLONG Addend) */ -.global @Exfi386InterlockedIncrementLong@4 +PUBLIC @Exfi386InterlockedIncrementLong@4 @Exfi386InterlockedIncrementLong@4: /* Do the op */ @@ -526,7 +524,7 @@ _ExpInterlockedPopEntrySListEnd@0: *FASTCALL *Exfi386InterlockedDecrementLong(IN PLONG Addend) */ -.global @Exfi386InterlockedDecrementLong@4 +PUBLIC @Exfi386InterlockedDecrementLong@4 @Exfi386InterlockedDecrementLong@4: /* Do the op */ @@ -542,7 +540,7 @@ _ExpInterlockedPopEntrySListEnd@0: *Exfi386InterlockedExchangeUlong(IN PULONG Taget, * IN ULONG Value) */ -.global @Exfi386InterlockedExchangeUlong@8 +PUBLIC @Exfi386InterlockedExchangeUlong@8 @Exfi386InterlockedExchangeUlong@8: #ifdef CONFIG_SMP @@ -552,9 +550,9 @@ _ExpInterlockedPopEntrySListEnd@0: #else /* On UP, use cmpxchg */ mov eax, [ecx] -1: +.l11: cmpxchg [ecx], edx - jnz 1b + jnz .l11 #endif /* Return */ @@ -566,7 +564,7 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PLONGLONG Exchange, * IN PLONGLONG Comperand) */ -.global @ExfInterlockedCompareExchange64@12 +PUBLIC @ExfInterlockedCompareExchange64@12 @ExfInterlockedCompareExchange64@12: /* Save registers */ @@ -598,7 +596,7 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PLONGLONG Comperand, * IN PKSPIN_LOCK Lock) */ -.global @ExInterlockedCompareExchange64@16 +PUBLIC @ExInterlockedCompareExchange64@16 @ExInterlockedCompareExchange64@16: /* Save registers */ @@ -630,7 +628,7 @@ _ExpInterlockedPopEntrySListEnd@0: *ExfInterlockedPopEntrySList(IN PSINGLE_LIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedPopEntrySList@8 +PUBLIC @ExfInterlockedPopEntrySList@8 @ExfInterlockedPopEntrySList@8: /* Save flags */ @@ -646,7 +644,7 @@ _ExpInterlockedPopEntrySListEnd@0: /* Get the next link and check if it's empty */ mov eax, [ecx] or eax, eax - jz 1f + jz .l12 /* Get address of the next link and store it */ push [eax] @@ -655,7 +653,7 @@ _ExpInterlockedPopEntrySListEnd@0: /* Decrement list depth */ dec dword ptr [ecx+4] -1: +.l12: #ifdef CONFIG_SMP /* Release spinlock */ RELEASE_SPINLOCK(edx) @@ -678,7 +676,7 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PSINGLE_LIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global @ExfInterlockedPushEntrySList@12 +PUBLIC @ExfInterlockedPushEntrySList@12 @ExfInterlockedPushEntrySList@12: /* Save flags */ @@ -727,7 +725,7 @@ _ExpInterlockedPopEntrySListEnd@0: * IN PLONGLONG Comperand, * IN PKSPIN_LOCK Lock) */ -.global @ExpInterlockedCompareExchange64@16 +PUBLIC @ExpInterlockedCompareExchange64@16 @ExpInterlockedCompareExchange64@16: /* Save registers */ @@ -802,4 +800,6 @@ NoMatch: pushfd SPIN_ON_LOCK(esi, .startc) #endif + +END /* EOF */ diff --git a/reactos/ntoskrnl/ex/i386/interlck_asm.S b/reactos/ntoskrnl/ex/i386/interlck_asm.S index 954091cee85..755813e80d8 100644 --- a/reactos/ntoskrnl/ex/i386/interlck_asm.S +++ b/reactos/ntoskrnl/ex/i386/interlck_asm.S @@ -8,14 +8,13 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include #include /* FUNCTIONS ****************************************************************/ .code32 -.text /* * NOTE: These functions must obey the following rules: @@ -31,7 +30,7 @@ * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedAddLargeInteger@16 +PUBLIC _ExInterlockedAddLargeInteger@16 _ExInterlockedAddLargeInteger@16: /* Prepare stack frame */ @@ -97,7 +96,7 @@ _ExInterlockedAddLargeInteger@16: * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedAddUlong@12 +PUBLIC _ExInterlockedAddUlong@12 _ExInterlockedAddUlong@12: /* Save flags and disable interrupts */ @@ -153,7 +152,7 @@ _ExInterlockedAddUlong@12: * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedInsertHeadList@12 +PUBLIC _ExInterlockedInsertHeadList@12 _ExInterlockedInsertHeadList@12: /* Save lock pointer */ @@ -189,12 +188,12 @@ _ExInterlockedInsertHeadList@12: /* check if the list was empty and return NULL */ xor eax, edx - jz 2f + jz .l2 /* Return pointer */ mov eax, edx -2: +.l2: ret 12 #ifdef CONFIG_SMP @@ -209,7 +208,7 @@ _ExInterlockedInsertHeadList@12: * IN PLIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedInsertTailList@12 +PUBLIC _ExInterlockedInsertTailList@12 _ExInterlockedInsertTailList@12: /* Save lock pointer */ @@ -245,12 +244,12 @@ _ExInterlockedInsertTailList@12: /* Check if the list was empty and return NULL */ xor eax, edx - jz 2f + jz .l3 /* Return pointer */ mov eax, edx -2: +.l3: ret 12 #ifdef CONFIG_SMP @@ -264,7 +263,7 @@ _ExInterlockedInsertTailList@12: *ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedRemoveHeadList@8 +PUBLIC _ExInterlockedRemoveHeadList@8 _ExInterlockedRemoveHeadList@8: /* Save lock pointer */ @@ -284,7 +283,7 @@ _ExInterlockedRemoveHeadList@8: /* Check if it's empty */ cmp eax, edx - je 2f + je .l4 /* Get next entry and do deletion */ mov ecx, [eax] @@ -303,7 +302,7 @@ _ExInterlockedRemoveHeadList@8: /* Return */ ret 8 -2: +.l4: /* Release lock */ #ifdef CONFIG_SMP mov edx, [esp+12] @@ -328,7 +327,7 @@ _ExInterlockedRemoveHeadList@8: *ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedPopEntryList@8 +PUBLIC _ExInterlockedPopEntryList@8 _ExInterlockedPopEntryList@8: /* Save lock pointer */ @@ -348,13 +347,13 @@ _ExInterlockedPopEntryList@8: /* Check if it's empty */ or eax, eax - je 3f + je .l6 /* Get next entry and do deletion */ mov edx, [eax] mov [ecx], edx -2: +.l5: /* Release lock */ #ifdef CONFIG_SMP mov ecx, [esp+12] @@ -367,10 +366,10 @@ _ExInterlockedPopEntryList@8: /* Return */ ret 8 -3: +.l6: /* Return empty list */ xor eax, eax - jmp 2b + jmp .l5 #ifdef CONFIG_SMP .spin6: @@ -384,7 +383,7 @@ _ExInterlockedPopEntryList@8: * IN PSINGLE_LIST_ENTRY ListEntry, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedPushEntryList@12 +PUBLIC _ExInterlockedPushEntryList@12 _ExInterlockedPushEntryList@12: /* Save lock pointer */ @@ -430,7 +429,7 @@ _ExInterlockedPushEntryList@12: *ExInterlockedIncrementLong(IN PLONG Addend, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedIncrementLong@8 +PUBLIC _ExInterlockedIncrementLong@8 _ExInterlockedIncrementLong@8: /* Get addend */ @@ -449,7 +448,7 @@ _ExInterlockedIncrementLong@8: *ExInterlockedDecrementLong(IN PLONG Addend, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedDecrementLong@8 +PUBLIC _ExInterlockedDecrementLong@8 _ExInterlockedDecrementLong@8: /* Get addend */ @@ -469,7 +468,7 @@ _ExInterlockedDecrementLong@8: * IN ULONG Value, * IN PKSPIN_LOCK Lock) */ -.global _ExInterlockedExchangeUlong@12 +PUBLIC _ExInterlockedExchangeUlong@12 _ExInterlockedExchangeUlong@12: /* Get pointers */ @@ -498,7 +497,7 @@ _ExInterlockedExchangeUlong@12: *Exi386InterlockedIncrementLong(IN PLONG Addend, * IN PKSPIN_LOCK Lock) */ -.global _Exi386InterlockedIncrementLong@4 +PUBLIC _Exi386InterlockedIncrementLong@4 _Exi386InterlockedIncrementLong@4: /* Get addend */ @@ -517,7 +516,7 @@ _Exi386InterlockedIncrementLong@4: *Exi386InterlockedDecrementLong(IN PLONG Addend, * IN PKSPIN_LOCK Lock) */ -.global _Exi386InterlockedDecrementLong@4 +PUBLIC _Exi386InterlockedDecrementLong@4 _Exi386InterlockedDecrementLong@4: /* Get addend */ @@ -537,7 +536,7 @@ _Exi386InterlockedDecrementLong@4: * IN ULONG Value, * IN PKSPIN_LOCK Lock) */ -.global _Exi386InterlockedExchangeUlong@12 +PUBLIC _Exi386InterlockedExchangeUlong@12 _Exi386InterlockedExchangeUlong@12: /* Get pointers */ @@ -560,5 +559,6 @@ _Exi386InterlockedExchangeUlong@12: /* Return */ ret 8 - + +END /* EOF */ diff --git a/reactos/ntoskrnl/ex/i386/ioport.S b/reactos/ntoskrnl/ex/i386/ioport.S index c9c55a160f4..ba456c799f8 100644 --- a/reactos/ntoskrnl/ex/i386/ioport.S +++ b/reactos/ntoskrnl/ex/i386/ioport.S @@ -8,54 +8,52 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include /* GLOBALS *******************************************************************/ -.globl _READ_REGISTER_UCHAR@4 -.globl _READ_REGISTER_USHORT@4 -.globl _READ_REGISTER_ULONG@4 -.globl _READ_REGISTER_BUFFER_UCHAR@12 -.globl _READ_REGISTER_BUFFER_USHORT@12 -.globl _READ_REGISTER_BUFFER_ULONG@12 -.globl _WRITE_REGISTER_UCHAR@8 -.globl _WRITE_REGISTER_USHORT@8 -.globl _WRITE_REGISTER_ULONG@8 -.globl _WRITE_REGISTER_BUFFER_UCHAR@12 -.globl _WRITE_REGISTER_BUFFER_USHORT@12 -.globl _WRITE_REGISTER_BUFFER_ULONG@12 +PUBLIC _READ_REGISTER_UCHAR@4 +PUBLIC _READ_REGISTER_USHORT@4 +PUBLIC _READ_REGISTER_ULONG@4 +PUBLIC _READ_REGISTER_BUFFER_UCHAR@12 +PUBLIC _READ_REGISTER_BUFFER_USHORT@12 +PUBLIC _READ_REGISTER_BUFFER_ULONG@12 +PUBLIC _WRITE_REGISTER_UCHAR@8 +PUBLIC _WRITE_REGISTER_USHORT@8 +PUBLIC _WRITE_REGISTER_ULONG@8 +PUBLIC _WRITE_REGISTER_BUFFER_UCHAR@12 +PUBLIC _WRITE_REGISTER_BUFFER_USHORT@12 +PUBLIC _WRITE_REGISTER_BUFFER_ULONG@12 /* FUNCTIONS *****************************************************************/ -.func READ_REGISTER_UCHAR@4 +.code + _READ_REGISTER_UCHAR@4: /* Return the requested memory location */ mov edx, [esp+4] mov al, [edx] ret 4 -.endfunc -.func READ_REGISTER_USHORT@4 + _READ_REGISTER_USHORT@4: /* Return the requested memory location */ mov edx, [esp+4] mov ax, [edx] ret 4 -.endfunc -.func READ_REGISTER_ULONG@4 + _READ_REGISTER_ULONG@4: /* Return the requested memory location */ mov edx, [esp+4] mov eax, [edx] ret 4 -.endfunc -.func READ_REGISTER_BUFFER_UCHAR@12 + _READ_REGISTER_BUFFER_UCHAR@12: /* Save volatiles */ @@ -72,9 +70,8 @@ _READ_REGISTER_BUFFER_UCHAR@12: mov edi, edx mov esi, eax ret 12 -.endfunc -.func READ_REGISTER_BUFFER_USHORT@12 + _READ_REGISTER_BUFFER_USHORT@12: /* Save volatiles */ @@ -91,9 +88,8 @@ _READ_REGISTER_BUFFER_USHORT@12: mov edi, edx mov esi, eax ret 12 -.endfunc -.func READ_REGISTER_BUFFER_ULONG@12 + _READ_REGISTER_BUFFER_ULONG@12: /* Save volatiles */ @@ -110,9 +106,8 @@ _READ_REGISTER_BUFFER_ULONG@12: mov edi, edx mov esi, eax ret 12 -.endfunc -.func WRITE_REGISTER_UCHAR@8 + _WRITE_REGISTER_UCHAR@8: /* Write to memory */ @@ -123,9 +118,8 @@ _WRITE_REGISTER_UCHAR@8: /* Flush posted write buffers and return */ lock or [esp+4], edx ret 8 -.endfunc -.func WRITE_REGISTER_USHORT@8 + _WRITE_REGISTER_USHORT@8: /* Write to memory */ @@ -136,9 +130,8 @@ _WRITE_REGISTER_USHORT@8: /* Flush posted write buffers and return */ lock or [esp+4], edx ret 8 -.endfunc -.func WRITE_REGISTER_ULONG@8 + _WRITE_REGISTER_ULONG@8: /* Write to memory */ @@ -149,9 +142,8 @@ _WRITE_REGISTER_ULONG@8: /* Flush posted write buffers and return */ lock or [esp+4], edx ret 8 -.endfunc -.func WRITE_REGISTER_BUFFER_UCHAR@12 + _WRITE_REGISTER_BUFFER_UCHAR@12: /* Save volatiles */ @@ -171,9 +163,8 @@ _WRITE_REGISTER_BUFFER_UCHAR@12: mov edi, edx mov esi, eax ret 12 -.endfunc -.func WRITE_REGISTER_BUFFER_USHORT@12 + _WRITE_REGISTER_BUFFER_USHORT@12: /* Save volatiles */ @@ -193,9 +184,8 @@ _WRITE_REGISTER_BUFFER_USHORT@12: mov edi, edx mov esi, eax ret 12 -.endfunc -.func WRITE_REGISTER_BUFFER_ULONG@12 + _WRITE_REGISTER_BUFFER_ULONG@12: /* Save volatiles */ @@ -215,6 +205,6 @@ _WRITE_REGISTER_BUFFER_ULONG@12: mov edi, edx mov esi, eax ret 12 -.endfunc +END /* EOF */ diff --git a/reactos/ntoskrnl/include/internal/i386/asmmacro.S b/reactos/ntoskrnl/include/internal/i386/asmmacro.S index 6ddb9d015ad..2a64a938320 100644 --- a/reactos/ntoskrnl/include/internal/i386/asmmacro.S +++ b/reactos/ntoskrnl/include/internal/i386/asmmacro.S @@ -60,8 +60,8 @@ // @remark None. // MACRO(idt, Handler, Bits) - .long \Handler - .short \Bits + .long VAL(Handler) + .short VAL(Bits) .short KGDT_R0_CODE ENDM @@ -128,17 +128,17 @@ MACRO(KiEnterTrap, Flags) mov [esp + KTRAP_FRAME_EAX], eax /* Does the caller want nonvolatiles only? */ - if ((Flags AND KI_NONVOLATILES_ONLY) == 0) + if (NOT (Flags AND KI_NONVOLATILES_ONLY)) /* Otherwise, save the volatiles as well */ mov [esp + KTRAP_FRAME_ECX], ecx mov [esp + KTRAP_FRAME_EDX], edx endif /* Save segment registers? */ - if ((Flags AND KI_DONT_SAVE_SEGS) == 0) + if (NOT (Flags AND KI_DONT_SAVE_SEGS)) /* Check for V86 mode */ - test byte ptr [esp + KTRAP_FRAME_EFLAGS + 2], (EFLAGS_V86_MASK >> 16) + test byte ptr [esp + KTRAP_FRAME_EFLAGS + 2], (EFLAGS_V86_MASK / HEX(10000)) jz not_v86_trap /* Restore V8086 segments into Protected Mode segments */ @@ -173,7 +173,7 @@ set_sane_segs: mov es, ax /* Fast system calls have fs already fixed */ - if ((Flags AND KI_FAST_SYSTEM_CALL) == 0) + if (NOT (Flags AND KI_FAST_SYSTEM_CALL)) /* Otherwise fix fs now */ mov ax, KGDT_R0_PCR mov fs, ax @@ -296,7 +296,7 @@ PUBLIC @&Name&@4 mov ecx, [esp - OffsetEsp + KTRAP_FRAME_ESP] /* Keep interrupts disabled until the sti / sysexit */ - and byte ptr [esp - OffsetEsp + KTRAP_FRAME_EFLAGS + 1], ~(EFLAGS_INTERRUPT_MASK >> 8) + and byte ptr [esp - OffsetEsp + KTRAP_FRAME_EFLAGS + 1], NOT (EFLAGS_INTERRUPT_MASK / HEX(100)) endif diff --git a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S index eb777010513..eca6dcfbdac 100644 --- a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S +++ b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S @@ -1,7 +1,9 @@ -#include -#include -.globl KdbEnter +#include + +#include + +PUBLIC KdbEnter KdbEnter: /* save flags */ @@ -149,4 +151,6 @@ KdbpStackSwitchAndCall: mov rsp, rax /* Return */ - ret \ No newline at end of file + ret + +END \ No newline at end of file diff --git a/reactos/ntoskrnl/kdbg/i386/kdb_help.S b/reactos/ntoskrnl/kdbg/i386/kdb_help.S index 00cb522c17c..e586f14c5e7 100644 --- a/reactos/ntoskrnl/kdbg/i386/kdb_help.S +++ b/reactos/ntoskrnl/kdbg/i386/kdb_help.S @@ -1,68 +1,72 @@ -#include -.text +#include +#include -.globl _KdbEnter +EXTERN _KdbEnterDebuggerException:PROC + +.code + +PUBLIC _KdbEnter _KdbEnter: /* * Set up a trap frame */ - pushfl /* Eflags */ - pushl %cs /* Cs */ - pushl $0 /* ErrorCode */ - pushl %ebp /* Ebp */ - pushl %ebx /* Ebx */ - movl 20(%esp), %ebp /* Eip */ - movl 16(%esp), %ebx /* Eflags */ - movl %ebx, 20(%esp) - movl 12(%esp), %ebx /* Cs */ - movl %ebx, 16(%esp) - movl %ebp, 12(%esp) - pushl %esi /* Esi */ - pushl %edi /* Edi */ - pushl %fs /* Fs */ - pushl $0 /* ExceptionList */ - pushl $0 /* PreviousMode */ - pushl %eax /* Eax */ - pushl %ecx /* Ecx */ - pushl %edx /* Edx */ - pushl %ds /* Ds */ - pushl %es /* Es */ - pushl %gs /* Gs */ - movl %dr7, %eax - pushl %eax /* Dr7 */ + pushf /* Eflags */ + push cs /* Cs */ + push 0 /* ErrorCode */ + push ebp /* Ebp */ + push ebx /* Ebx */ + mov ebp, [esp + 20] /* Eip */ + mov ebx, [esp + 16] /* Eflags */ + mov [esp + 20], ebx + mov ebx, [esp + 12] /* Cs */ + mov [esp + 16], ebx + mov [esp + 12], ebp + push esi /* Esi */ + push edi /* Edi */ + push fs /* Fs */ + push 0 /* ExceptionList */ + push 0 /* PreviousMode */ + push eax /* Eax */ + push ecx /* Ecx */ + push edx /* Edx */ + push ds /* Ds */ + push es /* Es */ + push gs /* Gs */ + mov eax, dr7 + push eax /* Dr7 */ /* Clear all breakpoint enables in dr7. */ - andl $0xFFFF0000, %eax - movl %eax, %dr7 - movl %dr6, %eax - pushl %eax /* Dr6 */ - movl %dr3, %eax - pushl %eax /* Dr3 */ - movl %dr2, %eax - pushl %eax /* Dr2 */ - movl %dr1, %eax - pushl %eax /* Dr1 */ - movl %dr0, %eax - pushl %eax /* Dr0 */ - leal 0x58(%esp), %eax - pushl %eax /* TempEsp */ - pushl %ss /* TempSegSs */ - pushl $0 /* DebugPointer */ - pushl $3 /* DebugArgMark (Exception number) */ - pushl 0x60(%esp) /* DebugEip */ - pushl %ebp /* DebugEbp */ + and eax, HEX(0FFFF0000) + mov dr7, eax + mov eax, dr6 + push eax /* Dr6 */ + mov eax, dr3 + push eax /* Dr3 */ + mov eax, dr2 + push eax /* Dr2 */ + mov eax, dr1 + push eax /* Dr1 */ + mov eax, dr0 + push eax /* Dr0 */ + lea eax, [esp + HEX(58)] + push eax /* TempEsp */ + push ss /* TempSegSs */ + push 0 /* DebugPointer */ + push 3 /* DebugArgMark (Exception number) */ + push [esp + HEX(60)] /* DebugEip */ + push ebp /* DebugEbp */ /* * Call KDB */ - movl %esp, %eax - pushl $1 /* FirstChance */ - pushl %eax /* Push a pointer to the trap frame */ - pushl $0 /* Context */ - pushl $0 /* PreviousMode (KernelMode) */ - pushl $0 /* ExceptionRecord */ - call _KdbEnterDebuggerException + mov eax, esp + push 1 /* FirstChance */ + push eax /* Push a pointer to the trap frame */ + push 0 /* Context */ + push 0 /* PreviousMode (KernelMode) */ + push 0 /* ExceptionRecord */ + call _KdbEnterDebuggerException /* * Pop the arguments and unused portions of the trap frame: @@ -73,41 +77,41 @@ _KdbEnter: * TempSegSs * TempEsp */ - addl $(11*4), %esp + add esp, 11*4 /* * Restore/update debugging registers. */ - popl %eax /* Dr0 */ - movl %eax, %dr0 - popl %eax /* Dr1 */ - movl %eax, %dr1 - popl %eax /* Dr2 */ - movl %eax, %dr2 - popl %eax /* Dr3 */ - movl %eax, %dr3 - popl %eax /* Dr6 */ - movl %eax, %dr6 - popl %eax /* Dr7 */ - movl %eax, %dr7 + pop eax /* Dr0 */ + mov dr0, eax + pop eax /* Dr1 */ + mov dr1, eax + pop eax /* Dr2 */ + mov dr2, eax + pop eax /* Dr3 */ + mov dr3, eax + pop eax /* Dr6 */ + mov dr6, eax + pop eax /* Dr7 */ + mov dr7, eax /* * Restore registers including any that might have been changed * inside the debugger. */ - popl %gs /* Gs */ - popl %es /* Es */ - popl %ds /* Ds */ - popl %edx /* Edx */ - popl %ecx /* Ecx */ - popl %eax /* Eax */ - addl $8, %esp /* PreviousMode, ExceptionList */ - popl %fs /* Fs */ - popl %edi /* Edi */ - popl %esi /* Esi */ - popl %ebx /* Ebx */ - popl %ebp /* Ebp */ - addl $4, %esp /* ErrorCode */ + pop gs /* Gs */ + pop es /* Es */ + pop ds /* Ds */ + pop edx /* Edx */ + pop ecx /* Ecx */ + pop eax /* Eax */ + add esp, 8 /* PreviousMode, ExceptionList */ + pop fs /* Fs */ + pop edi /* Edi */ + pop esi /* Esi */ + pop ebx /* Ebx */ + pop ebp /* Ebp */ + add esp, 4 /* ErrorCode */ /* * Return to the caller. @@ -115,26 +119,27 @@ _KdbEnter: iret -.globl _KdbpStackSwitchAndCall@8 +PUBLIC _KdbpStackSwitchAndCall@8 _KdbpStackSwitchAndCall@8: - pushl %ebp - movl %esp, %ebp + push ebp + mov ebp, esp - movl 0x8(%esp), %eax /* New stack */ - movl 0xC(%esp), %ecx /* Function to call */ - movl %esp, %edx /* Old stack */ + mov eax, [esp + 8] /* New stack */ + mov ecx, [esp + 12] /* Function to call */ + mov edx, esp /* Old stack */ /* Switch stack */ - movl %eax, %esp - pushl %edx + mov esp, eax + push edx /* Call function */ - call *%ecx + call ecx /* Switch back to old stack */ - popl %esp + pop esp /* Return */ - popl %ebp - ret $8 + pop ebp + ret 8 +END diff --git a/reactos/ntoskrnl/ke/amd64/boot.S b/reactos/ntoskrnl/ke/amd64/boot.S index f1715c6663e..4efbef3f94a 100644 --- a/reactos/ntoskrnl/ke/amd64/boot.S +++ b/reactos/ntoskrnl/ke/amd64/boot.S @@ -2,14 +2,14 @@ * FILE: ntoskrnl/ke/i386/boot.S * COPYRIGHT: See COPYING in the top level directory * PURPOSE: FreeLDR Wrapper Bootstrap Code and Bootstrap Trampoline - * PROGRAMMERs: Alex Ionescu (alex@relsoft.net) - * Thomas Weidenmueller + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include EXTERN KiInitializeKernelAndGotoIdleLoop:PROC diff --git a/reactos/ntoskrnl/ke/amd64/ctxswitch.S b/reactos/ntoskrnl/ke/amd64/ctxswitch.S index 61ce1473e53..1c9b13e5737 100644 --- a/reactos/ntoskrnl/ke/amd64/ctxswitch.S +++ b/reactos/ntoskrnl/ke/amd64/ctxswitch.S @@ -9,8 +9,9 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 532f6bbdb91..2b95b42894d 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -7,8 +7,9 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include + +#include EXTERN KiDispatchException:PROC EXTERN FrLdrDbgPrint:DWORD diff --git a/reactos/ntoskrnl/ke/i386/ctxswitch.S b/reactos/ntoskrnl/ke/i386/ctxswitch.S index 9a9c95f4db1..8fba093426f 100644 --- a/reactos/ntoskrnl/ke/i386/ctxswitch.S +++ b/reactos/ntoskrnl/ke/i386/ctxswitch.S @@ -10,22 +10,27 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include + +EXTERN @KiSwapContextEntry@8:PROC +EXTERN @KiSwapContextExit@8:PROC +EXTERN @KiRetireDpcList@4:PROC +EXTERN @KiEnterV86Mode@4:PROC +EXTERN @KiExitV86Mode@4:PROC /* FUNCTIONS ****************************************************************/ +.code -.globl @KiSwapContextInternal@0 -.func @KiSwapContextInternal@0, @KiSwapContextInternal@0 +PUBLIC @KiSwapContextInternal@0 @KiSwapContextInternal@0: /* Build switch frame */ sub esp, 2 * 4 mov ecx, esp jmp @KiSwapContextEntry@8 -.endfunc -.globl @KiSwapContext@8 -.func @KiSwapContext@8, @KiSwapContext@8 + +PUBLIC @KiSwapContext@8 @KiSwapContext@8: /* Save 4 registers */ sub esp, 4 * 4 @@ -51,10 +56,9 @@ /* Clean stack */ add esp, 4 * 4 ret -.endfunc -.globl @KiSwitchThreads@8 -.func @KiSwitchThreads@8, @KiSwitchThreads@8 + +PUBLIC @KiSwitchThreads@8 @KiSwitchThreads@8: /* Load the new kernel stack and switch OS to new thread */ mov esp, edx @@ -63,10 +67,9 @@ /* Now we're on the new thread. Return to the caller to restore registers */ add esp, 2 * 4 ret -.endfunc -.globl @KiRetireDpcListInDpcStack@8 -.func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8 + +PUBLIC @KiRetireDpcListInDpcStack@8 @KiRetireDpcListInDpcStack@8: /* Switch stacks and retire DPCs */ mov eax, esp @@ -77,11 +80,10 @@ /* Return on original stack */ pop esp ret -.endfunc + /* FIXFIX: Move to C code ****/ -.globl _Ki386SetupAndExitToV86Mode@4 -.func Ki386SetupAndExitToV86Mode@4 +PUBLIC _Ki386SetupAndExitToV86Mode@4 _Ki386SetupAndExitToV86Mode@4: /* Enter V8086 mode */ @@ -90,9 +92,9 @@ _Ki386SetupAndExitToV86Mode@4: mov ecx, esp call @KiEnterV86Mode@4 jmp $ -.endfunc -.globl @Ki386BiosCallReturnAddress@4 + +PUBLIC @Ki386BiosCallReturnAddress@4 @Ki386BiosCallReturnAddress@4: /* Exit V8086 mode */ @@ -102,3 +104,4 @@ _Ki386SetupAndExitToV86Mode@4: popad ret 4 +END diff --git a/reactos/ntoskrnl/ke/i386/trap.s b/reactos/ntoskrnl/ke/i386/trap.s index adfcd322dd9..f3c99c48c77 100644 --- a/reactos/ntoskrnl/ke/i386/trap.s +++ b/reactos/ntoskrnl/ke/i386/trap.s @@ -9,8 +9,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include #include MACRO(GENERATE_IDT_STUB, Number) @@ -18,16 +18,19 @@ idt _KiUnexpectedInterrupt&Number, INT_32_DPL0 ENDM MACRO(GENERATE_INT_HANDLER, Number) -.func KiUnexpectedInterrupt&Number +//.func KiUnexpectedInterrupt&Number _KiUnexpectedInterrupt&Number: push PRIMARY_VECTOR_BASE + Number jmp _KiEndUnexpectedRange@0 -.endfunc +//.endfunc ENDM +EXTERN _KiTrap02:PROC + /* GLOBALS *******************************************************************/ .data +ASSUME nothing PUBLIC _KiIdt _KiIdt: @@ -52,9 +55,9 @@ idt _KiTrap10, INT_32_DPL0 /* INT 10: x87 FPU Error (#MF) */ idt _KiTrap11, INT_32_DPL0 /* INT 11: Align Check Exception (#AC) */ idt _KiTrap0F, INT_32_DPL0 /* INT 12: Machine Check Exception (#MC)*/ idt _KiTrap0F, INT_32_DPL0 /* INT 13: SIMD FPU Exception (#XF) */ -.rept 22 +REPEAT 22 idt _KiTrap0F, INT_32_DPL0 /* INT 14-29: UNDEFINED INTERRUPTS */ -.endr +ENDR idt _KiGetTickCount, INT_32_DPL3 /* INT 2A: Get Tick Count Handler */ idt _KiCallbackReturn, INT_32_DPL3 /* INT 2B: User-Mode Callback Return */ idt _KiRaiseAssertion, INT_32_DPL3 /* INT 2C: Debug Assertion Handler */ @@ -62,15 +65,15 @@ idt _KiDebugService, INT_32_DPL3 /* INT 2D: Debug Service Handler */ idt _KiSystemService, INT_32_DPL3 /* INT 2E: System Call Service Handler */ idt _KiTrap0F, INT_32_DPL0 /* INT 2F: RESERVED */ i = 0 -.rept 208 +REPEAT 208 GENERATE_IDT_STUB %i i = i + 1 -.endr +ENDR PUBLIC _KiIdtDescriptor _KiIdtDescriptor: .short 0 - .short 0x7FF + .short HEX(7FF) .long _KiIdt PUBLIC _KiUnexpectedEntrySize @@ -78,8 +81,7 @@ _KiUnexpectedEntrySize: .long _KiUnexpectedInterrupt1 - _KiUnexpectedInterrupt0 /******************************************************************************/ -.code32 -.text +.code TRAP_ENTRY KiTrap00, KI_PUSH_FAKE_ERROR_CODE TRAP_ENTRY KiTrap01, KI_PUSH_FAKE_ERROR_CODE @@ -106,7 +108,7 @@ TRAP_ENTRY KiDebugService, KI_PUSH_FAKE_ERROR_CODE TRAP_ENTRY KiUnexpectedInterruptTail, 0 ALIGN 4 -EXTERN @KiInterruptTemplateHandler@8 +EXTERN @KiInterruptTemplateHandler@8:PROC PUBLIC _KiInterruptTemplate _KiInterruptTemplate: KiEnterTrap KI_PUSH_FAKE_ERROR_CODE @@ -135,10 +137,10 @@ _KiFastCallEntry: PUBLIC _KiStartUnexpectedRange@0 _KiStartUnexpectedRange@0: i = 0 -.rept 208 +REPEAT 208 GENERATE_INT_HANDLER %i i = i + 1 -.endr +ENDR PUBLIC _KiEndUnexpectedRange@0 _KiEndUnexpectedRange@0: jmp _KiUnexpectedInterruptTail diff --git a/reactos/ntoskrnl/ke/i386/usercall_asm.S b/reactos/ntoskrnl/ke/i386/usercall_asm.S index 2da726882eb..dcdc7ba9e88 100644 --- a/reactos/ntoskrnl/ke/i386/usercall_asm.S +++ b/reactos/ntoskrnl/ke/i386/usercall_asm.S @@ -8,17 +8,18 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include #include +EXTERN _MmGrowKernelStack@4:PROC +EXTERN _KeUserCallbackDispatcher:PROC +EXTERN @KiServiceExit@8:PROC + /* FUNCTIONS ****************************************************************/ +.code -.code32 -.text - -.globl _KiGetUserModeStackAddress@0 -.func KiGetUserModeStackAddress@0 +PUBLIC _KiGetUserModeStackAddress@0 _KiGetUserModeStackAddress@0: /* Get the current thread's trapframe and return the esp */ @@ -27,7 +28,6 @@ _KiGetUserModeStackAddress@0: lea eax, [eax+KTRAP_FRAME_ESP] ret -.endfunc /*++ * @name KiCallUserMode @@ -53,8 +53,7 @@ _KiGetUserModeStackAddress@0: * This call MUST be paired by interrupt 0x2B or NtCallbackReturn. * *--*/ -.globl _KiCallUserMode@8 -.func KiCallUserMode@8 +PUBLIC _KiCallUserMode@8 _KiCallUserMode@8: /* Save volatile registers */ @@ -102,7 +101,7 @@ ApcsEnabled: #endif /* Get the lowest stack limit and check if we can handle it */ - lea eax, [esp-0x3000] + lea eax, [esp-HEX(3000)] cmp eax, [ebx+KTHREAD_STACK_LIMIT] jnb StackOk @@ -130,7 +129,7 @@ StackOk: mov [ebx+KTHREAD_CALLBACK_STACK], esp /* Align stack on 16-byte boundary */ - and esp, ~15 + and esp, NOT 15 mov edi, esp /* Set destination and origin NPX Areas */ @@ -181,7 +180,7 @@ DontBias: /* Copy DR7 */ mov edi, [edx+KTRAP_FRAME_DR7] - test edi, ~DR7_RESERVED_MASK + test edi, NOT DR7_RESERVED_MASK mov [esp+KTRAP_FRAME_DR7], edi /* Check if we need to save debug registers */ @@ -226,7 +225,6 @@ GrowFailed: /* Return */ ret 8 -.endfunc /*++ * @name NtCallbackReturn @@ -251,8 +249,7 @@ GrowFailed: * @remark This call MUST be paired with KeUserModeCallback. * *--*/ -.globl _NtCallbackReturn@12 -.func NtCallbackReturn@12 +PUBLIC _NtCallbackReturn@12 _NtCallbackReturn@12: /* Get the current thread and make sure we have a callback stack */ @@ -316,7 +313,7 @@ CheckDebug: and dword ptr [edi+KTRAP_FRAME_DR7], 0 /* Check if debugging was active */ - test byte ptr [eax+KTHREAD_DEBUG_ACTIVE], 0xFF + test byte ptr [eax+KTHREAD_DEBUG_ACTIVE], HEX(0FF) jnz RestoreDebug RestoreStack: @@ -407,7 +404,6 @@ NoStack: /* Return failure */ mov eax, STATUS_NO_CALLBACK_ACTIVE ret 12 -.endfunc /*++ * @name KeSwitchKernelStack @@ -429,8 +425,7 @@ NoStack: * this routine. * *--*/ -.globl _KeSwitchKernelStack@8 -.func KeSwitchKernelStack@8 +PUBLIC _KeSwitchKernelStack@8 _KeSwitchKernelStack@8: /* Save volatiles */ @@ -515,4 +510,5 @@ V86Switch: pop edi pop esi ret 8 -.endfunc + +END diff --git a/reactos/ntoskrnl/rtl/i386/stack.S b/reactos/ntoskrnl/rtl/i386/stack.S index d71cc4f0c3e..7fbb6e0106a 100644 --- a/reactos/ntoskrnl/rtl/i386/stack.S +++ b/reactos/ntoskrnl/rtl/i386/stack.S @@ -8,13 +8,13 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include /* FUNCTIONS *****************************************************************/ +.code -.func RtlpGetStackLimits@8 -.globl _RtlpGetStackLimits@8 +PUBLIC _RtlpGetStackLimits@8 _RtlpGetStackLimits@8: /* Get the current thread */ @@ -34,4 +34,5 @@ _RtlpGetStackLimits@8: /* return */ ret 8 -.endfunc + +END diff --git a/reactos/subsystems/win32/win32k/dib/i386/dib24bpp_hline.s b/reactos/subsystems/win32/win32k/dib/i386/dib24bpp_hline.s index 24451140f7c..1d36aa4bb9c 100644 --- a/reactos/subsystems/win32/win32k/dib/i386/dib24bpp_hline.s +++ b/reactos/subsystems/win32/win32k/dib/i386/dib24bpp_hline.s @@ -6,13 +6,12 @@ * PROGRAMMERS: Magnus Olsen */ -.globl _DIB_24BPP_HLine -.intel_syntax noprefix +#include + +.code + +PUBLIC _DIB_24BPP_HLine -.def _DIB_24BPP_HLine; -.scl 2; -.type 32; -.endef _DIB_24BPP_HLine: push edi push esi @@ -151,3 +150,5 @@ pop esi pop edi ret + +END diff --git a/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_colorfill.s b/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_colorfill.s index fce9f7f84c0..00a83804a73 100644 --- a/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_colorfill.s +++ b/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_colorfill.s @@ -7,15 +7,16 @@ * Timo Kreuzer (timo.kreuzer@reactos.org) */ -.intel_syntax noprefix +#include +.code /* * BOOLEAN * _cdecl * DIB_32BPP_ColorFill(SURFOBJ* pso, RECTL* prcl, ULONG iColor); */ -.globl _DIB_32BPP_ColorFill +PUBLIC _DIB_32BPP_ColorFill _DIB_32BPP_ColorFill: push ebp mov ebp, esp @@ -27,22 +28,22 @@ _DIB_32BPP_ColorFill: mov edx, [ebp+12] /* edx = prcl */ mov ecx, [ebp+8] /* ecx = pso */ - mov ebx, [ecx+0x24] /* ebx = pso->lDelta; */ + mov ebx, [ecx+36] /* ebx = pso->lDelta; */ mov [esp], ebx /* lDelta = pso->lDelta; */ mov edi, [edx+4] /* edi = prcl->top; */ mov eax, edi /* eax = prcl->top; */ imul eax, ebx /* eax = prcl->top * pso->lDelta; */ - add eax, [ecx+0x20] /* eax += pso->pvScan0; */ + add eax, [ecx+32] /* eax += pso->pvScan0; */ mov ebx, [edx] /* ebx = prcl->left; */ lea esi, [eax+ebx*4] /* esi = pvLine0 = eax + 4 * prcl->left; */ mov ebx, [edx+8] /* ebx = prcl->right; */ sub ebx, [edx] /* ebx = prcl->right - prcl->left; */ - jbe end /* if (ebx <= 0) goto end; */ + jbe .end /* if (ebx <= 0) goto end; */ mov edx, [edx+12] /* edx = prcl->bottom; */ sub edx, edi /* edx -= prcl->top; */ - jbe end /* if (eax <= 0) goto end; */ + jbe .end /* if (eax <= 0) goto end; */ mov eax, [ebp+16] /* eax = iColor; */ cld @@ -55,7 +56,7 @@ for_loop: /* do { */ dec edx /* cy--; */ jnz for_loop /* } while (cy > 0); */ -end: +.end: mov eax, 1 add esp, 4 pop edi @@ -63,3 +64,5 @@ end: pop ebx pop ebp ret + +END diff --git a/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_hline.s b/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_hline.s index f976b8741bf..c60d43d6343 100644 --- a/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_hline.s +++ b/reactos/subsystems/win32/win32k/dib/i386/dib32bpp_hline.s @@ -6,13 +6,11 @@ * PROGRAMMERS: Magnus Olsen */ -.globl _DIB_32BPP_HLine -.intel_syntax noprefix +#include -.def _DIB_32BPP_HLine; -.scl 2; -.type 32; -.endef +.code + +PUBLIC _DIB_32BPP_HLine _DIB_32BPP_HLine: sub esp, 12 // rember the base is not hex it is dec @@ -55,3 +53,4 @@ _save_rest: add esp, 12 ret +END diff --git a/reactos/subsystems/win32/win32k/eng/i386/floatobj.S b/reactos/subsystems/win32/win32k/eng/i386/floatobj.S index 6a9a3324729..c046bcfbeec 100644 --- a/reactos/subsystems/win32/win32k/eng/i386/floatobj.S +++ b/reactos/subsystems/win32/win32k/eng/i386/floatobj.S @@ -6,6 +6,9 @@ * PROGRAMMER: Timo Kreuzer */ +#include + +.code /******************************************************************************* * IEEE 754-1985 single precision floating point @@ -72,9 +75,6 @@ * FLOATOBJ_SubLong - wrapper */ -.intel_syntax noprefix -.text - #define lMant 0 #define lExp 4 @@ -87,24 +87,24 @@ * FLOATOBJ_SetFloat(IN OUT PFLOATOBJ pf, IN FLOATL f); */ _FLOATOBJ_SetFloat@8: -.global _FLOATOBJ_SetFloat@8 +PUBLIC _FLOATOBJ_SetFloat@8 push ebp mov ebp, esp mov ecx, [esp + PARAM2] /* Load the float into ecx */ mov eax, ecx /* Copy float to eax for later */ - test ecx, 0x7f800000 /* Check for zero exponent - 0 or denormal */ + test ecx, HEX(7f800000) /* Check for zero exponent - 0 or denormal */ jz SetFloat0 /* If it's all zero, ... */ shl ecx, 7 /* Put the bits for the mantissa in place */ cdq /* Fill edx with the sign from the FLOATL in eax */ - and ecx, 0x7fffffff /* Mask out invalid field in the mantissa */ + and ecx, HEX(7fffffff) /* Mask out invalid field in the mantissa */ shr eax, 23 /* Shift the exponent in eax in place */ - or ecx, 0x40000000 /* Set bit for 1 in the mantissa */ - and eax, 0xff /* Mask out invalid fields in the exponent in eax */ + or ecx, HEX(40000000) /* Set bit for 1 in the mantissa */ + and eax, HEX(0ff) /* Mask out invalid fields in the exponent in eax */ xor ecx, edx /* Make use of the sign bit expanded to full edx */ @@ -136,7 +136,7 @@ SetFloat0: * */ _FLOATOBJ_GetFloat@4: -.global _FLOATOBJ_GetFloat@4 +PUBLIC _FLOATOBJ_GetFloat@4 push ebp mov ebp, esp @@ -152,13 +152,13 @@ _FLOATOBJ_GetFloat@4: sub eax, edx jz GetFloatRet - and ecx, 0xff /* Mask out invalid fields in the exponent */ - and eax, 0x3fffffff /* Mask out invalid fields in mantissa */ + and ecx, HEX(0ff) /* Mask out invalid fields in the exponent */ + and eax, HEX(3fffffff) /* Mask out invalid fields in mantissa */ shl ecx, 23 /* Shift exponent in place */ shr eax, 7 /* Shift mantissa in place */ - and edx, 0x80000000 /* Reduce edx to sign bit only */ + and edx, HEX(80000000) /* Reduce edx to sign bit only */ or eax, ecx /* Set exponent in result */ or eax, edx /* Set sign bit in result */ @@ -178,7 +178,7 @@ GetFloatRet: * Instead of using abs(l), which is 3 + 2 instructions, use a branch. */ _FLOATOBJ_SetLong@8: -.global _FLOATOBJ_SetLong@8 +PUBLIC _FLOATOBJ_SetLong@8 push ebp mov ebp, esp @@ -236,7 +236,7 @@ SetLong0: * */ _FLOATOBJ_GetLong@4: -.global _FLOATOBJ_GetLong@4 +PUBLIC _FLOATOBJ_GetLong@4 push ebp mov ebp, esp @@ -263,7 +263,7 @@ GetLong2: * FLOATOBJ_Equal(IN PFLOATOBJ pf1, IN PFLOATOBJ pf2); */ _FLOATOBJ_Equal@8: -.global _FLOATOBJ_Equal@8 +PUBLIC _FLOATOBJ_Equal@8 push ebp mov ebp, esp @@ -291,7 +291,7 @@ _FLOATOBJ_Equal@8: * FLOATOBJ_EqualLong(IN PFLOATOBJ pf, IN LONG l); */ _FLOATOBJ_EqualLong@8: -.global _FLOATOBJ_EqualLong@8 +PUBLIC _FLOATOBJ_EqualLong@8 push ebp mov ebp, esp @@ -325,7 +325,7 @@ EqualLongFalse: * */ _FLOATOBJ_GreaterThan@8: -.global _FLOATOBJ_GreaterThan@8 +PUBLIC _FLOATOBJ_GreaterThan@8 push ebp mov ebp, esp @@ -415,7 +415,7 @@ GreaterThan_neg2: * LOATOBJ_GreaterThan */ _FLOATOBJ_GreaterThanLong@8: -.global _FLOATOBJ_GreaterThanLong@8 +PUBLIC _FLOATOBJ_GreaterThanLong@8 push ebp mov ebp, esp @@ -445,7 +445,7 @@ _FLOATOBJ_GreaterThanLong@8: * */ _FLOATOBJ_LessThan@8: -.global _FLOATOBJ_LessThan@8 +PUBLIC _FLOATOBJ_LessThan@8 push ebp mov ebp, esp @@ -536,7 +536,7 @@ LessThan_neg2: * Currently implemented as a wrapper around FLOATOBJ_SetLong and FLOATOBJ_LessThan */ _FLOATOBJ_LessThanLong@8: -.global _FLOATOBJ_LessThanLong@8 +PUBLIC _FLOATOBJ_LessThanLong@8 push ebp mov ebp, esp @@ -569,7 +569,7 @@ _FLOATOBJ_LessThanLong@8: * No special handling for 0, where mantissa is 0 */ _FLOATOBJ_Mul@8: -.global _FLOATOBJ_Mul@8 +PUBLIC _FLOATOBJ_Mul@8 push ebp mov ebp, esp @@ -620,7 +620,7 @@ MulNeg: lea edx, [edx + ecx -2] /* Normalize exponent in edx */ - or eax, 0x80000000 /* Set sign bit */ + or eax, HEX(80000000) /* Set sign bit */ mov ecx, [esp + PARAM1] /* Load pf1 into ecx */ mov [ecx + lMant], eax /* Save back mantissa */ @@ -646,7 +646,7 @@ Mul0: * Currently implemented as a wrapper around FLOATOBJ_SetFloat and FLOATOBJ_Mul */ _FLOATOBJ_MulFloat@8: -.global _FLOATOBJ_MulFloat@8 +PUBLIC _FLOATOBJ_MulFloat@8 push ebp mov ebp, esp @@ -675,7 +675,7 @@ _FLOATOBJ_MulFloat@8: * Currently implemented as a wrapper around FLOATOBJ_SetLong and FLOATOBJ_Mul */ _FLOATOBJ_MulLong@8: -.global _FLOATOBJ_MulLong@8 +PUBLIC _FLOATOBJ_MulLong@8 push ebp mov ebp, esp @@ -703,7 +703,7 @@ _FLOATOBJ_MulLong@8: * */ _FLOATOBJ_Div@8: -.global _FLOATOBJ_Div@8 +PUBLIC _FLOATOBJ_Div@8 push ebp mov ebp, esp push ebx @@ -736,7 +736,7 @@ _FLOATOBJ_Div@8: div ecx /* Do an unsigned divide */ xor ecx, ecx /* Adjust result */ - test eax, 0x80000000 + test eax, HEX(80000000) setnz cl shr eax, cl @@ -773,7 +773,7 @@ Div0: * Currently implemented as a wrapper around FLOATOBJ_SetFloat and FLOATOBJ_Div */ _FLOATOBJ_DivFloat@8: -.global _FLOATOBJ_DivFloat@8 +PUBLIC _FLOATOBJ_DivFloat@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -802,7 +802,7 @@ _FLOATOBJ_DivFloat@8: * Currently implemented as a wrapper around FLOATOBJ_SetLong and FLOATOBJ_Div */ _FLOATOBJ_DivLong@8: -.global _FLOATOBJ_DivLong@8 +PUBLIC _FLOATOBJ_DivLong@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -829,7 +829,7 @@ _FLOATOBJ_DivLong@8: * */ _FLOATOBJ_Add@8: -.global _FLOATOBJ_Add@8 +PUBLIC _FLOATOBJ_Add@8 push ebp mov ebp, esp push ebx @@ -928,7 +928,7 @@ AddIs0: * Currently implemented as a wrapper around FLOATOBJ_SetFloat and FLOATOBJ_Add */ _FLOATOBJ_AddFloat@8: -.global _FLOATOBJ_AddFloat@8 +PUBLIC _FLOATOBJ_AddFloat@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -957,7 +957,7 @@ _FLOATOBJ_AddFloat@8: * Currently implemented as a wrapper around FLOATOBJ_SetLong and FLOATOBJ_Add */ _FLOATOBJ_AddLong@8: -.global _FLOATOBJ_AddLong@8 +PUBLIC _FLOATOBJ_AddLong@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -985,7 +985,7 @@ _FLOATOBJ_AddLong@8: * */ _FLOATOBJ_Sub@8: -.global _FLOATOBJ_Sub@8 +PUBLIC _FLOATOBJ_Sub@8 push ebp mov ebp, esp push ebx @@ -1083,7 +1083,7 @@ SubIs0: * Currently implemented as a wrapper around FLOATOBJ_SetFloat and FLOATOBJ_Sub */ _FLOATOBJ_SubFloat@8: -.global _FLOATOBJ_SubFloat@8 +PUBLIC _FLOATOBJ_SubFloat@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -1112,7 +1112,7 @@ _FLOATOBJ_SubFloat@8: * Currently implemented as a wrapper around FLOATOBJ_SetLong and FLOATOBJ_Sub */ _FLOATOBJ_SubLong@8: -.global _FLOATOBJ_SubLong@8 +PUBLIC _FLOATOBJ_SubLong@8 push ebp mov ebp, esp sub esp, 8 /* Make room for a FLOATOBJ on the stack */ @@ -1140,7 +1140,7 @@ _FLOATOBJ_SubLong@8: * */ _FLOATOBJ_Neg@4: -.global _FLOATOBJ_Neg@4 +PUBLIC _FLOATOBJ_Neg@4 push ebp mov ebp, esp @@ -1150,5 +1150,5 @@ _FLOATOBJ_Neg@4: pop ebp /* Return */ ret 4 - +END /* EOF */ diff --git a/reactos/subsystems/win32/win32k/misc/i386/atan2_asm.s b/reactos/subsystems/win32/win32k/misc/i386/atan2_asm.s index 1ce05320559..75aca5f7b30 100644 --- a/reactos/subsystems/win32/win32k/misc/i386/atan2_asm.s +++ b/reactos/subsystems/win32/win32k/misc/i386/atan2_asm.s @@ -33,13 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _atan2 - -.intel_syntax noprefix +#include + /* FUNCTIONS ***************************************************************/ +.code +PUBLIC _atan2 _atan2: push ebp mov ebp,esp @@ -49,3 +49,5 @@ _atan2: mov esp,ebp pop ebp ret + +END diff --git a/reactos/subsystems/win32/win32k/misc/i386/ceil_asm.s b/reactos/subsystems/win32/win32k/misc/i386/ceil_asm.s index aad69114f5a..1256fa1cf00 100644 --- a/reactos/subsystems/win32/win32k/misc/i386/ceil_asm.s +++ b/reactos/subsystems/win32/win32k/misc/i386/ceil_asm.s @@ -33,13 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _ceil -.intel_syntax noprefix +#include /* FUNCTIONS ***************************************************************/ +.code +PUBLIC _ceil _ceil: push ebp mov ebp,esp @@ -47,7 +47,7 @@ _ceil: fld qword ptr [ebp+8] // Load real from stack fstcw [ebp-2] // Save control word fclex // Clear exceptions - mov word ptr [ebp-4],0xb63 // Rounding control word + mov word ptr [ebp-4],HEX(b63) // Rounding control word fldcw [ebp-4] // Set new rounding control frndint // Round to integer fclex // Clear exceptions @@ -55,3 +55,5 @@ _ceil: mov esp,ebp // Deallocate temporary space pop ebp ret + +END diff --git a/reactos/subsystems/win32/win32k/misc/i386/cos_asm.s b/reactos/subsystems/win32/win32k/misc/i386/cos_asm.s index b1c6ada49b2..8b525755b17 100644 --- a/reactos/subsystems/win32/win32k/misc/i386/cos_asm.s +++ b/reactos/subsystems/win32/win32k/misc/i386/cos_asm.s @@ -33,13 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _cos -.intel_syntax noprefix +#include /* FUNCTIONS ***************************************************************/ +.code +PUBLIC _cos _cos: push ebp mov ebp,esp // Point to the stack frame @@ -47,3 +47,5 @@ _cos: fcos // Take the cosine pop ebp ret + +END diff --git a/reactos/subsystems/win32/win32k/misc/i386/floor_asm.s b/reactos/subsystems/win32/win32k/misc/i386/floor_asm.s index f03c85cb4e8..1f5f2b107df 100644 --- a/reactos/subsystems/win32/win32k/misc/i386/floor_asm.s +++ b/reactos/subsystems/win32/win32k/misc/i386/floor_asm.s @@ -33,13 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _floor - -.intel_syntax noprefix + +#include /* FUNCTIONS ***************************************************************/ +.code +PUBLIC _floor _floor: push ebp mov ebp,esp @@ -47,7 +47,7 @@ _floor: fld qword ptr [ebp+8] // Load real from stack fstcw [ebp-2] // Save control word fclex // Clear exceptions - mov word ptr [ebp-4],0x763 // Rounding control word + mov word ptr [ebp-4],HEX(763) // Rounding control word fldcw [ebp-4] // Set new rounding control frndint // Round to integer fclex // Clear exceptions @@ -55,3 +55,5 @@ _floor: mov esp,ebp pop ebp ret + +END diff --git a/reactos/subsystems/win32/win32k/misc/i386/sin_asm.s b/reactos/subsystems/win32/win32k/misc/i386/sin_asm.s index 39791a3e989..7ec0fa69c23 100644 --- a/reactos/subsystems/win32/win32k/misc/i386/sin_asm.s +++ b/reactos/subsystems/win32/win32k/misc/i386/sin_asm.s @@ -33,13 +33,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -.globl _sin -.intel_syntax noprefix +#include /* FUNCTIONS ***************************************************************/ +.code +PUBLIC _sin _sin: push ebp // Save register bp mov ebp,esp // Point to the stack frame @@ -47,3 +47,5 @@ _sin: fsin // Take the sine pop ebp // Restore register bp ret + +END diff --git a/reactos/tools/nci/ncitool.c b/reactos/tools/nci/ncitool.c index 07838af1efa..ca10a815a5b 100644 --- a/reactos/tools/nci/ncitool.c +++ b/reactos/tools/nci/ncitool.c @@ -50,16 +50,15 @@ * This stubs calls into KUSER_SHARED_DATA where either a * sysenter or interrupt is performed, depending on CPU support. */ -#if defined(__GNUC__) -#define UserModeStub_x86 " movl $0x%x, %%eax\n" \ - " movl $KUSER_SHARED_SYSCALL, %%ecx\n" \ - " call *(%%ecx)\n" \ - " ret $0x%x\n\n" +#define UserModeStub_x86 " mov eax, %d\n" \ + " mov ecx, KUSER_SHARED_SYSCALL\n" \ + " call dword ptr [ecx]\n" \ + " ret %d\n\n" -#define UserModeStub_amd64 " movl $0x%x, %%eax\n" \ - " movq %%rcx, %%r10\n" \ +#define UserModeStub_amd64 " mov eax, %d\n" \ + " mov r10, rcx\n" \ " syscall\n" \ - " ret $0x%x\n\n" + " ret %d\n\n" #define UserModeStub_ppc " stwu 1,-16(1)\n" \ " mflr 0\n\t" \ @@ -79,32 +78,21 @@ #define UserModeStub_arm " swi #0x%x\n" \ " bx lr\n\n" -#elif defined(_MSC_VER) -#define UserModeStub_x86 " asm { \n" \ - " mov eax, %xh\n" \ - " mov ecx, KUSER_SHARED_SYSCALL\n" \ - " call [ecx]\n" \ - " ret %xh\n" \ - " }\n" -#else -#error Unknown compiler for inline assembler -#endif /* * This stub calls KiSystemService directly with a fake INT2E stack. * Because EIP is pushed during the call, the handler will return here. */ -#if defined(__GNUC__) -#define KernelModeStub_x86 " movl $0x%x, %%eax\n" \ - " leal 4(%%esp), %%edx\n" \ - " pushfl\n" \ - " pushl $KGDT_R0_CODE\n" \ +#define KernelModeStub_x86 " mov eax, %d\n" \ + " lea edx, [esp + 4]\n" \ + " pushf\n" \ + " push KGDT_R0_CODE\n" \ " call _KiSystemService\n" \ - " ret $0x%x\n\n" + " ret %d\n\n" -#define KernelModeStub_amd64 " movl $0x%x, %%eax\n" \ +#define KernelModeStub_amd64 " mov eax, %d\n" \ " call KiSystemService\n" \ - " ret $0x%x\n\n" + " ret %d\n\n" /* For now, use the usermode stub. We'll optimize later */ #define KernelModeStub_ppc UserModeStub_ppc @@ -116,19 +104,6 @@ " swi #0x%x\n" \ " bx ip\n\n" -#elif defined(_MSC_VER) -#define KernelModeStub_x86 " asm { \n" \ - " mov eax, %xh\n" \ - " lea edx, [esp+4]\n" \ - " pushf\n" \ - " push KGDT_R0_CODE\n" \ - " call _KiSystemService\n" \ - " ret %xh\n" \ - " }\n" -#else -#error Unknown compiler for inline assembler -#endif - /***** Arch Dependent Stuff ******/ struct ncitool_data_t { const char *arch; @@ -141,9 +116,9 @@ struct ncitool_data_t { struct ncitool_data_t ncitool_data[] = { { "i386", 4, KernelModeStub_x86, UserModeStub_x86, - ".global _%s@%d\n", "_%s@%d:\n" }, + "PUBLIC _%s@%d\n", "_%s@%d:\n" }, { "amd64", 4, KernelModeStub_amd64, UserModeStub_amd64, - ".global %s\n", "%s:\n" }, + "PUBLIC %s\n", "%s:\n" }, { "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc, "\t.globl %s\n", "%s:\n" }, { "mips", 4, KernelModeStub_mips, UserModeStub_mips, @@ -192,14 +167,14 @@ WriteFileHeader(FILE * StubFile, " * PURPOSE: %s\n" " * PROGRAMMER: Computer Generated File. See tools/nci/ncitool.c\n" " * REMARK: DO NOT EDIT OR COMMIT MODIFICATIONS TO THIS FILE\n" - " */\n\n\n" - "#include \n\n", + " */\n\n\n", + FileDescription, FileLocation); } /*++ - * WriteFileHeader + * WriteStubHeader * * Prints out the File Header for a Stub File. * @@ -393,6 +368,7 @@ CreateStubs(FILE * SyscallDb, char *SyscallArguments; int SyscallId; unsigned StackBytes; + unsigned int i; /* We loop, incrementing the System Call Index, until the end of the file */ for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) { @@ -408,26 +384,23 @@ CreateStubs(FILE * SyscallDb, if (NtSyscallName) { /* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */ - int i; for (i= 0; i < UserFiles; i++) { - /* Write the Nt Version */ - WriteUserModeStub(UserModeFiles[i], - NtSyscallName, - StackBytes, - SyscallId | Index); + /* Write the Stub Header and export the Function */ + WriteStubHeader(UserModeFiles[i], NtSyscallName, StackBytes); /* If a Zw Version is needed (was specified), write it too */ if (NeedsZw) { NtSyscallName[0] = 'Z'; NtSyscallName[1] = 'w'; - WriteUserModeStub(UserModeFiles[i], - NtSyscallName, - StackBytes, - SyscallId | Index); + + /* Write the Stub Header and export the Function */ + WriteStubHeader(UserModeFiles[i], NtSyscallName, StackBytes); } + /* Write the Stub Code */ + fprintf(UserModeFiles[i], UserModeStub, SyscallId | Index, StackBytes); } /* Create the Kernel coutnerparts (only Zw*, Nt* are the real functions!) */ @@ -445,6 +418,11 @@ CreateStubs(FILE * SyscallDb, SyscallId++; } } + +#if defined(_MSC_VER) + for (i= 0; i < UserFiles; i++) fprintf(UserModeFiles[i], "END\n"); + fprintf(KernelModeFile, "END\n"); +#endif } /*++ @@ -627,7 +605,7 @@ CreateSpec(FILE * SyscallDb, /* Make sure we really extracted something */ if (NtSyscallName) { - int i; + unsigned int i; for (i= 0; i < CountFiles; i++) { if (!UseZw) { @@ -670,7 +648,7 @@ void usage(char * argv0) int main(int argc, char* argv[]) { - FILE * Files[Arguments] = { }; + FILE * Files[Arguments] = {0}; int FileNumber, ArgOffset = 1; char * OpenType = "r"; @@ -710,15 +688,24 @@ int main(int argc, char* argv[]) WriteFileHeader(Files[NtosUserStubs], "System Call Stubs for Native API", argv[NtosUserStubs + ArgOffset]); + fputs("#include \n" + "#include \n" + ".code\n\n", Files[NtosUserStubs]); WriteFileHeader(Files[NtosKernelStubs], "System Call Stubs for Native API", argv[NtosKernelStubs + ArgOffset]); - fputs("#include \n\n", Files[NtosKernelStubs]); + fputs("#include \n" + "#include \n" + ".code\n" + "EXTERN _KiSystemService:PROC\n\n", Files[NtosKernelStubs]); WriteFileHeader(Files[Win32kStubs], "System Call Stubs for Native API", argv[Win32kStubs + ArgOffset]); + fputs("#include \n" + "#include \n" + ".code\n\n", Files[Win32kStubs]); /* Create the System Stubs */ CreateStubs(Files[NativeSystemDb], @@ -772,3 +759,4 @@ int main(int argc, char* argv[]) return(0); } + From 250e056ecef8d214b6cdee9c37a8db8dcc2d6362 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 27 Nov 2010 22:24:15 +0000 Subject: [PATCH 119/132] revert r49824 svn path=/trunk/; revision=49827 --- reactos/tools/xml.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/reactos/tools/xml.cpp b/reactos/tools/xml.cpp index 50125e129d6..8400ce131ed 100644 --- a/reactos/tools/xml.cpp +++ b/reactos/tools/xml.cpp @@ -18,7 +18,6 @@ #ifdef _MSC_VER #pragma warning ( disable : 4786 ) -#pragma warning ( disable : 4996 ) #endif//_MSC_VER #ifdef WIN32 @@ -42,6 +41,7 @@ #include #include #include "xml.h" +#include "ssprintf.h" #ifndef MAX_PATH #define MAX_PATH _MAX_PATH @@ -100,9 +100,7 @@ XMLException::XMLException ( void XMLException::SetExceptionV ( const std::string& location, const char* format, va_list args ) { - char buffer[1024]; - _vsnprintf(buffer, sizeof(buffer)-1, format, args); - _e = location + ": " + buffer; + _e = location + ": " + ssvprintf(format,args); } void XMLException::SetException ( const std::string& location, const char* format, ... ) @@ -426,14 +424,13 @@ string XMLFile::Location() const { int line = 1; - char line_str[10]; const char* p = strchr ( _buf.c_str(), '\n' ); while ( p && p < _p ) { ++line; p = strchr ( p+1, '\n' ); } - return _filename + "(" + itoa(line, line_str, 10) + ")"; + return ssprintf ( "%s(%i)",_filename.c_str(), line ); } XMLAttribute::XMLAttribute() From af040adf503922bcd242fc22b6ae3c98795f2a3b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 28 Nov 2010 00:10:02 +0000 Subject: [PATCH 120/132] [CRT] Fix typos svn path=/trunk/; revision=49830 --- reactos/lib/sdk/crt/setjmp/i386/setjmp.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s index dc0e9656b3a..68916996a4f 100644 --- a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s @@ -101,13 +101,13 @@ _longjmp: mov eax, [esp + 8] /* Second argument is return value. */ /* Save the return address now. */ - mov edx, [edx + JB_IP*4] + mov edx, [ecx + JB_IP*4] /* Restore registers. */ - mov ebp, [edx + JB_BP*4] - mov ebx, [edx + JB_BX*4] - mov edi, [edx + JB_DI*4] - mov esi, [edx + JB_SI*4] - mov esp, [edx + JB_SP*4] + mov ebp, [ecx + JB_BP*4] + mov ebx, [ecx + JB_BX*4] + mov edi, [ecx + JB_DI*4] + mov esi, [ecx + JB_SI*4] + mov esp, [ecx + JB_SP*4] /* Jump to saved PC. */ jmp dword ptr [edx] From 52a1227b430fb2a392d52fe166bd4d04b690b0a5 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 28 Nov 2010 01:37:16 +0000 Subject: [PATCH 121/132] [User32] - Sync up with wine 1.2 rc6 menu so it will pass the tests from rev 47939. svn path=/trunk/; revision=49834 --- reactos/dll/win32/user32/windows/menu.c | 31 +++++++++++++++---------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index c9e87de47de..8f8610d64b1 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -3487,14 +3487,23 @@ static BOOL FASTCALL MenuInitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT HideCaret(0); + MenuGetRosMenuInfo(&MenuInfo, hMenu); + /* This makes the menus of applications built with Delphi work. + * It also enables menus to be displayed in more than one window, + * but there are some bugs left that need to be fixed in this case. + */ + if(MenuInfo.Self == hMenu) + { + MenuInfo.Wnd = hWnd; + MenuSetRosMenuInfo(&MenuInfo); + } + /* Send WM_ENTERMENULOOP and WM_INITMENU message only if TPM_NONOTIFY flag is not specified */ if (!(wFlags & TPM_NONOTIFY)) SendMessageW( hWnd, WM_ENTERMENULOOP, bPopup, 0 ); SendMessageW( hWnd, WM_SETCURSOR, (WPARAM)hWnd, HTCAPTION ); - MenuGetRosMenuInfo(&MenuInfo, hMenu); - if (!(wFlags & TPM_NONOTIFY)) { SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 ); @@ -3512,16 +3521,6 @@ static BOOL FASTCALL MenuInitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT } } - /* This makes the menus of applications built with Delphi work. - * It also enables menus to be displayed in more than one window, - * but there are some bugs left that need to be fixed in this case. - */ - if(MenuInfo.Self == hMenu) - { - MenuInfo.Wnd = hWnd; - MenuSetRosMenuInfo(&MenuInfo); - } - IntNotifyWinEvent( EVENT_SYSTEM_MENUSTART, hWnd, MenuInfo.Flags & MF_SYSMENU ? OBJID_SYSMENU : OBJID_MENU, @@ -3652,6 +3651,7 @@ BOOL WINAPI TrackPopupMenuEx( HMENU Menu, UINT Flags, int x, int y, HWND Wnd, LPTPMPARAMS Tpm) { BOOL ret = FALSE; + ROSMENUINFO MenuInfo; if (!IsMenu(Menu)) { @@ -3659,6 +3659,13 @@ BOOL WINAPI TrackPopupMenuEx( HMENU Menu, UINT Flags, int x, int y, return FALSE; } + MenuGetRosMenuInfo(&MenuInfo, Menu); + if (IsWindow(MenuInfo.Wnd)) + { + SetLastError( ERROR_POPUP_ALREADY_ACTIVE ); + return FALSE; + } + MenuInitTracking(Wnd, Menu, TRUE, Flags); /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ From 205fe71c5df45b5fdee7aa0297a4e68f11d6430f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 28 Nov 2010 09:53:22 +0000 Subject: [PATCH 122/132] [CRT] Fix another typo svn path=/trunk/; revision=49836 --- reactos/lib/sdk/crt/setjmp/i386/setjmp.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s index 68916996a4f..95c4aac27a3 100644 --- a/reactos/lib/sdk/crt/setjmp/i386/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/i386/setjmp.s @@ -109,6 +109,6 @@ _longjmp: mov esi, [ecx + JB_SI*4] mov esp, [ecx + JB_SP*4] /* Jump to saved PC. */ - jmp dword ptr [edx] + jmp edx END From 5afe6c4f39b672bcb50fd28b7d155b584ede190f Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sun, 28 Nov 2010 12:10:59 +0000 Subject: [PATCH 123/132] [ATL] - Ettl Martin: Make CComCriticalSection destructor virtual. See issue #4975 for more details. svn path=/trunk/; revision=49840 --- reactos/lib/atl/atlcore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/atl/atlcore.h b/reactos/lib/atl/atlcore.h index c2f22eacfdf..08e19d41382 100644 --- a/reactos/lib/atl/atlcore.h +++ b/reactos/lib/atl/atlcore.h @@ -43,7 +43,7 @@ public: memset(&m_sec, 0, sizeof(CRITICAL_SECTION)); } - ~CComCriticalSection() + virtual ~CComCriticalSection() { } From b0fb94b1f3ddcde521a000ed5cf993215d5f2a23 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 28 Nov 2010 16:33:56 +0000 Subject: [PATCH 124/132] [NTOSKRNL] Never read code & commit while being tired... svn path=/trunk/; revision=49848 --- reactos/ntoskrnl/fsrtl/dbcsname.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/dbcsname.c b/reactos/ntoskrnl/fsrtl/dbcsname.c index da0fd71cb47..903da2eeab3 100644 --- a/reactos/ntoskrnl/fsrtl/dbcsname.c +++ b/reactos/ntoskrnl/fsrtl/dbcsname.c @@ -140,7 +140,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) /*++ * @name FsRtlIsDbcsInExpression - * @halfplemented + * @implemented * * Check if the Name string is in the Expression string. * @@ -152,7 +152,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) * * @return TRUE if Name is found in Expression, FALSE otherwise * - * @remarks Implementation should be fixed to handle wildcards + * @remarks * *--*/ BOOLEAN From 14dc931ab1c3bb6d02c73a058ac0aa4dda829664 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 28 Nov 2010 16:38:51 +0000 Subject: [PATCH 125/132] [NTOSKRNL/MM] - Fix the use of an uninitialized variable. svn path=/trunk/; revision=49850 --- reactos/ntoskrnl/mm/ARM3/expool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/ARM3/expool.c b/reactos/ntoskrnl/mm/ARM3/expool.c index 79e5ef95dc7..120050e6aca 100644 --- a/reactos/ntoskrnl/mm/ARM3/expool.c +++ b/reactos/ntoskrnl/mm/ARM3/expool.c @@ -248,7 +248,7 @@ VOID NTAPI ExpCheckPoolBlocks(IN PVOID Block) { - BOOLEAN FoundBlock; + BOOLEAN FoundBlock = FALSE; SIZE_T Size = 0; PPOOL_HEADER Entry; From e8615c4221d19591595660bd3e7c602d003dc859 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 28 Nov 2010 16:43:40 +0000 Subject: [PATCH 126/132] [DDK] FsRtlRemoveBaseMcbEntry() return is VOID svn path=/trunk/; revision=49851 --- reactos/include/ddk/ntifs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/ddk/ntifs.h b/reactos/include/ddk/ntifs.h index 8c4f1a1bbad..a82cd79053a 100644 --- a/reactos/include/ddk/ntifs.h +++ b/reactos/include/ddk/ntifs.h @@ -7344,7 +7344,7 @@ FsRtlAddBaseMcbEntry( IN LONGLONG SectorCount); NTKERNELAPI -BOOLEAN +VOID NTAPI FsRtlRemoveBaseMcbEntry( IN PBASE_MCB Mcb, From 6a6c5e47e60bb42383ddb7049097b4e3ae66f805 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 28 Nov 2010 22:33:19 +0000 Subject: [PATCH 127/132] [NTOSKRNL/NEWCC] Init Dummy var even if just used for debug to suppress warning svn path=/trunk/; revision=49858 --- reactos/ntoskrnl/po/power.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index 42a0bb854db..a4f45c0f38c 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.c @@ -750,6 +750,8 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction, #ifndef NEWCC /* Flush dirty cache pages */ CcRosFlushDirtyPages(-1, &Dummy); +#else + Dummy = 0; #endif /* Flush all volumes and the registry */ From 081b22869e390014a774a64d0ac33dfdcfc1078c Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 29 Nov 2010 16:48:27 +0000 Subject: [PATCH 128/132] [User32] - Fixed export for PrintWindow see bug 5466 and 5609. svn path=/trunk/; revision=49861 --- reactos/dll/win32/user32/misc/stubs.c | 21 ++++----------------- reactos/dll/win32/user32/user32.pspec | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/reactos/dll/win32/user32/misc/stubs.c b/reactos/dll/win32/user32/misc/stubs.c index 354b5d3f31c..229c0a9bc7d 100644 --- a/reactos/dll/win32/user32/misc/stubs.c +++ b/reactos/dll/win32/user32/misc/stubs.c @@ -311,7 +311,7 @@ AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d) } /* - * @unimplemented + * @implemented */ LRESULT WINAPI @@ -320,8 +320,9 @@ DefRawInputProc( INT nInput, UINT cbSizeHeader) { - UNIMPLEMENTED; - return 0; + if (cbSizeHeader == sizeof(RAWINPUTHEADER)) + return S_OK; + return 1; } /* @@ -386,20 +387,6 @@ GetRegisteredRawInputDevices( return 0; } -/* - * @unimplemented - */ -BOOL -WINAPI -PrintWindow( - HWND hwnd, - HDC hdcBlt, - UINT nFlags) -{ - UNIMPLEMENTED; - return FALSE; -} - /* * @unimplemented */ diff --git a/reactos/dll/win32/user32/user32.pspec b/reactos/dll/win32/user32/user32.pspec index 603a025bf0d..3913a9a92df 100644 --- a/reactos/dll/win32/user32/user32.pspec +++ b/reactos/dll/win32/user32/user32.pspec @@ -526,7 +526,7 @@ @ stdcall PostQuitMessage(long) @ stdcall PostThreadMessageA(long long long long) @ stdcall PostThreadMessageW(long long long long) -; @ stub PrintWindow +@ stdcall PrintWindow(ptr ptr long) NtUserPrintWindow @ stdcall PrivateExtractIconExA(str long ptr ptr long) @ stdcall PrivateExtractIconExW(wstr long ptr ptr long) @ stdcall PrivateExtractIconsA(str long long long ptr ptr long long) From 76b3ad6788bb5bda66f138f4bc8016642734e1f8 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 30 Nov 2010 16:29:49 +0000 Subject: [PATCH 129/132] [DDRAW] - Jerome Gardou: Almost all of the ddraw->refcount winetests pass. One remains, due to the fact that IdirectDrawSurface::SetPalette is unimplemented. IDirectDraw::Createpalette is implemented too, but needs testing. There are no parameter checks. - Comments from me: The patch is not build-tested, however I did my best to merge it to existing ddraw and I prefer the actual code to be in the repository rather than hanging in bugzilla for years (last comment to the patch is dated 29.10.2009). See issue #4909 for more details. svn path=/trunk/; revision=49872 --- .../directx/ddraw/Ddraw/callbacks_dd_hel.c | 41 ++++- reactos/dll/directx/ddraw/Ddraw/ddraw_main.c | 30 +++- reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c | 7 - .../dll/directx/ddraw/Palette/createpalette.c | 135 +++++++++++++++ reactos/dll/directx/ddraw/Palette/palette.c | 157 ++++++++++++++++++ .../dll/directx/ddraw/Surface/createsurface.c | 1 - .../dll/directx/ddraw/Surface/surface_main.c | 20 ++- .../ddraw/Vtable/DirectDrawSurface4_Vtable.c | 4 +- .../ddraw/Vtable/DirectDrawSurface7_Vtable.c | 4 +- reactos/dll/directx/ddraw/ddraw.rbuild | 5 +- reactos/dll/directx/ddraw/rosdraw.h | 6 +- reactos/dll/directx/ddraw/startup.c | 21 ++- 12 files changed, 406 insertions(+), 25 deletions(-) create mode 100644 reactos/dll/directx/ddraw/Palette/createpalette.c create mode 100644 reactos/dll/directx/ddraw/Palette/palette.c diff --git a/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c b/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c index 8592543152c..57c30e346d8 100644 --- a/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c +++ b/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c @@ -75,9 +75,46 @@ DWORD CALLBACK HelDdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA lpCanCreateSu DX_STUB; } -DWORD CALLBACK HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette) +DWORD CALLBACK HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette) { - DX_STUB; + DDRAWI_DDRAWPALETTE_GBL* ddPalGbl = lpCreatePalette->lpDDPalette; + LOGPALETTE* logPal ; + WORD size=1; + + if(ddPalGbl->dwFlags & DDRAWIPAL_2) + size = 2; + else if(ddPalGbl->dwFlags & DDRAWIPAL_4) + size = 4; + else if(ddPalGbl->dwFlags & DDRAWIPAL_16) + size = 16; + else if(ddPalGbl->dwFlags & DDRAWIPAL_256) + size = 256; + + DxHeapMemAlloc(logPal, sizeof(LOGPALETTE) + size*sizeof(PALETTEENTRY)); + if(logPal == NULL) + { + lpCreatePalette->ddRVal = DDERR_OUTOFMEMORY; + return DDHAL_DRIVER_HANDLED; + } + + logPal->palVersion = 0x300; + logPal->palNumEntries = size; + CopyMemory(&logPal->palPalEntry[0], lpCreatePalette->lpColorTable, size*sizeof(PALETTEENTRY)); + + ddPalGbl->hHELGDIPalette = CreatePalette(logPal); + + if (ddPalGbl->hHELGDIPalette == NULL) + { + DxHeapMemFree(logPal); + lpCreatePalette->ddRVal = DDERR_INVALIDOBJECT; + return DDHAL_DRIVER_HANDLED; + } + + DxHeapMemFree(logPal); + ddPalGbl->lpColorTable = lpCreatePalette->lpColorTable; + ddPalGbl->dwFlags |= DDRAWIPAL_INHEL | DDRAWIPAL_GDI ; + lpCreatePalette->ddRVal = DD_OK; + return DDHAL_DRIVER_HANDLED; } DWORD CALLBACK HelDdGetScanLine(LPDDHAL_GETSCANLINEDATA lpGetScanLine) diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c index a3b307c8a04..fe02d0a0d76 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c @@ -533,6 +533,9 @@ Main_DirectDraw_CreateSurface4(LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pD } _SEH2_END; + if(*ppSurf != NULL) + Main_DirectDraw_AddRef(This); + LeaveCriticalSection(&ddcs); return ret; } @@ -540,7 +543,32 @@ Main_DirectDraw_CreateSurface4(LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pD /* 5 of 31 DirectDraw7_Vtable api are working simluare to windows */ /* 8 of 31 DirectDraw7_Vtable api are under devloping / testing */ - +HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, + LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter) +{ + HRESULT ret = DD_OK; + DX_WINDBG_trace(); + + EnterCriticalSection(&ddcs); + *ppPalette = NULL; + + _SEH2_TRY + { + ret = Internal_CreatePalette(This, dwFlags, palent, ppPalette, pUnkOuter); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ret = DDERR_INVALIDPARAMS; + } + _SEH2_END; + + //Versions 7 and 4 are addref'ed + if((This->lpVtbl == &DirectDraw7_Vtable || This->lpVtbl == &DirectDraw4_Vtable) && *ppPalette != NULL) + Main_DirectDraw_AddRef(This) ; + + LeaveCriticalSection(&ddcs); + return ret; +} diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c index a2c60e74b33..4f11676ea86 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c @@ -24,13 +24,6 @@ Main_DirectDraw_CreateClipper(LPDDRAWI_DIRECTDRAW_INT This, DX_STUB; } -HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, - LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter) -{ - DX_WINDBG_trace(); - DX_STUB; -} - HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDDRAWI_DIRECTDRAW_INT This, LPDIRECTDRAWSURFACE7 src, LPDIRECTDRAWSURFACE7* dst) { diff --git a/reactos/dll/directx/ddraw/Palette/createpalette.c b/reactos/dll/directx/ddraw/Palette/createpalette.c new file mode 100644 index 00000000000..87bb0a9f141 --- /dev/null +++ b/reactos/dll/directx/ddraw/Palette/createpalette.c @@ -0,0 +1,135 @@ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS DirectX + * FILE: ddraw/surface/createsurface.c + * PURPOSE: IDirectDrawPalette Creation + * PROGRAMMER: Jérôme Gardou + * + */ +#include "rosdraw.h" + +DWORD ConvertPCapsFlags(DWORD dwFlags) +{ + DWORD ret = 0; + if(dwFlags & DDPCAPS_4BIT) + ret|=DDRAWIPAL_16; + if(dwFlags & DDPCAPS_8BIT) + ret|=DDRAWIPAL_256; + if(dwFlags & DDPCAPS_8BITENTRIES) + ret|=DDRAWIPAL_STORED_8INDEX; + if(dwFlags & DDPCAPS_ALLOW256) + ret|=DDRAWIPAL_ALLOW256; + if(dwFlags & DDPCAPS_ALPHA) + ret|=DDRAWIPAL_ALPHA; + if(dwFlags & DDPCAPS_1BIT) + ret|=DDRAWIPAL_2; + if(dwFlags & DDPCAPS_2BIT) + ret|=DDRAWIPAL_4; + + return ret; +} + +HRESULT +Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags, + LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter) +{ + DDHAL_CREATEPALETTEDATA mDdCreatePalette = { 0 }; + + LPDDRAWI_DDRAWPALETTE_INT ThisPalInt = NULL; + LPDDRAWI_DDRAWPALETTE_LCL ThisPalLcl = NULL; + LPDDRAWI_DDRAWPALETTE_GBL ThisPalGbl = NULL; + + HRESULT ret; + + if(pUnkOuter) + { + return CLASS_E_NOAGGREGATION; + } + + if(!(pDDraw->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)) + { + return DDERR_NOCOOPERATIVELEVELSET; + } + + + if (pDDraw->lpLcl->dwProcessId != GetCurrentProcessId() ) + { + return DDERR_INVALIDOBJECT; + } + + /* Allocate the palette interface and needed members */ + DxHeapMemAlloc(ThisPalInt, sizeof( DDRAWI_DDRAWPALETTE_INT ) ); + if( ThisPalInt == NULL ) + { + ret = DDERR_OUTOFMEMORY; + goto cleanup; + } + + DxHeapMemAlloc(ThisPalLcl, sizeof( DDRAWI_DDRAWPALETTE_LCL ) ); + if( ThisPalLcl == NULL ) + { + ret = DDERR_OUTOFMEMORY; + goto cleanup; + } + + DxHeapMemAlloc(ThisPalGbl, sizeof( DDRAWI_DDRAWPALETTE_GBL ) ); + if( ThisPalGbl == NULL ) + { + ret = DDERR_OUTOFMEMORY; + goto cleanup; + } + + /*Some initial setup*/ + + ThisPalInt->lpLcl = ThisPalLcl; + ThisPalLcl->lpGbl = ThisPalGbl; + + ThisPalLcl->lpDD_lcl = ThisPalGbl->lpDD_lcl = pDDraw->lpLcl; + ThisPalGbl->dwFlags = ConvertPCapsFlags(dwFlags); + + ThisPalInt->lpVtbl = (PVOID)&DirectDrawPalette_Vtable; + ThisPalGbl->dwProcessId = GetCurrentProcessId(); + + mDdCreatePalette.lpDD = pDDraw->lpLcl->lpGbl; + mDdCreatePalette.lpDDPalette = ThisPalGbl; + if(pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATEPALETTE) { + mDdCreatePalette.CreatePalette = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.CreatePalette; + DX_STUB_str("Using HAL CreatePalette\n"); + } + else { + mDdCreatePalette.CreatePalette = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreatePalette; + DX_STUB_str("Using HEL CreatePalette\n"); + } + mDdCreatePalette.ddRVal = DDERR_GENERIC; + mDdCreatePalette.lpColorTable = palent; + + if (mDdCreatePalette.CreatePalette(&mDdCreatePalette) == DDHAL_DRIVER_NOTHANDLED) + { + DX_STUB_str("mDdCreateSurface failed with DDHAL_DRIVER_NOTHANDLED."); + ret = DDERR_NOTINITIALIZED; + goto cleanup; + } + + if (mDdCreatePalette.ddRVal != DD_OK) + { + DX_STUB_str("mDdCreateSurface failed."); + ret = mDdCreatePalette.ddRVal; + goto cleanup; + } + + *ppPalette = (LPDIRECTDRAWPALETTE)ThisPalInt; + ThisPalInt->lpLink = pDDraw->lpLcl->lpGbl->palList; + pDDraw->lpLcl->lpGbl->palList = ThisPalInt; + ThisPalInt->lpLcl->dwReserved1 = (ULONG_PTR)pDDraw; + IDirectDrawPalette_AddRef(*ppPalette); + + return DD_OK; + +cleanup: + if(ThisPalInt) DxHeapMemFree(ThisPalInt); + if(ThisPalLcl) DxHeapMemFree(ThisPalLcl); + if(ThisPalGbl) DxHeapMemFree(ThisPalGbl); + + return ret; +} diff --git a/reactos/dll/directx/ddraw/Palette/palette.c b/reactos/dll/directx/ddraw/Palette/palette.c new file mode 100644 index 00000000000..c366be9206c --- /dev/null +++ b/reactos/dll/directx/ddraw/Palette/palette.c @@ -0,0 +1,157 @@ +/* $Id: palette.c $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS DirectX + * FILE: ddraw/Palette/palette.c + * PURPOSE: IDirectDrawPalette Implementation + * PROGRAMMER: Jérôme Gardou + * + */ + +#include "rosdraw.h" + +/***************************************************************************** + * IDirectDrawPalette::QueryInterface + * + * A usual QueryInterface implementation. Can only Query IUnknown and + * IDirectDrawPalette + * + * Params: + * refiid: The interface id queried for + * obj: Address to return the interface pointer at + * + * Returns: + * S_OK on success + * E_NOINTERFACE if the requested interface wasn't found + *****************************************************************************/ +static HRESULT WINAPI +DirectDrawPalette_QueryInterface(IDirectDrawPalette *iface, + REFIID refiid, + void **obj) +{ + if (IsEqualGUID(refiid, &IID_IUnknown) + || IsEqualGUID(refiid, &IID_IDirectDrawPalette)) + { + *obj = iface; + IDirectDrawPalette_AddRef(iface); + return S_OK; + } + else + { + *obj = NULL; + return E_NOINTERFACE; + } +} + +/***************************************************************************** + * IDirectDrawPaletteImpl::AddRef + * + * Increases the refcount. + * + * Returns: + * The new refcount + * + *****************************************************************************/ +static ULONG WINAPI +DirectDrawPalette_AddRef(IDirectDrawPalette *iface) +{ + LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + ULONG ref = 0; + + _SEH2_TRY + { + ref = ++This->dwIntRefCnt; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END + + return ref; +} + +/***************************************************************************** + * IDirectDrawPaletteImpl::Release + * + * Reduces the refcount. If the refcount falls to 0, the object is destroyed + * + * Returns: + * The new refcount + * + *****************************************************************************/ +static ULONG WINAPI +DirectDrawPalette_Release(IDirectDrawPalette *iface) +{ + LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + ULONG ref = 0; + + _SEH2_TRY + { + ref = --This->dwIntRefCnt; + if(ref == 0) + { + AcquireDDThreadLock(); + if(((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw7_Vtable + || ((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw4_Vtable) + Main_DirectDraw_Release((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1) ; + DxHeapMemFree(This); //HUGE FIXME!!! + ReleaseDDThreadLock(); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END + + return ref; +} + +static HRESULT WINAPI +DirectDrawPalette_Initialize( LPDIRECTDRAWPALETTE iface, + LPDIRECTDRAW ddraw, + DWORD dwFlags, + LPPALETTEENTRY palent) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +static HRESULT WINAPI +DirectDrawPalette_GetEntries( LPDIRECTDRAWPALETTE iface, + DWORD dwFlags, + DWORD dwStart, DWORD dwCount, + LPPALETTEENTRY palent) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +static HRESULT WINAPI +DirectDrawPalette_SetEntries( LPDIRECTDRAWPALETTE iface, + DWORD dwFlags, + DWORD dwStart, + DWORD dwCount, + LPPALETTEENTRY palent) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +static HRESULT WINAPI +DirectDrawPalette_GetCaps( LPDIRECTDRAWPALETTE iface, + LPDWORD lpdwCaps) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable = +{ + DirectDrawPalette_QueryInterface, + DirectDrawPalette_AddRef, + DirectDrawPalette_Release, + DirectDrawPalette_GetCaps, + DirectDrawPalette_GetEntries, + DirectDrawPalette_Initialize, + DirectDrawPalette_SetEntries +}; diff --git a/reactos/dll/directx/ddraw/Surface/createsurface.c b/reactos/dll/directx/ddraw/Surface/createsurface.c index c34396f309d..d6d95579a3d 100644 --- a/reactos/dll/directx/ddraw/Surface/createsurface.c +++ b/reactos/dll/directx/ddraw/Surface/createsurface.c @@ -182,7 +182,6 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD, /* FIXME ThisSurfaceMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop */ ThisSurfMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop = 1; pDDraw->lpLcl->lpPrimary = ThisSurfInt; - Main_DirectDraw_AddRef(pDDraw); } else { diff --git a/reactos/dll/directx/ddraw/Surface/surface_main.c b/reactos/dll/directx/ddraw/Surface/surface_main.c index 28bc2c34bb1..81abdf8f88d 100644 --- a/reactos/dll/directx/ddraw/Surface/surface_main.c +++ b/reactos/dll/directx/ddraw/Surface/surface_main.c @@ -264,14 +264,28 @@ Main_DDrawSurface_QueryInterface(LPDDRAWI_DDRAWSURFACE_INT This, REFIID riid, LP ULONG WINAPI Main_DDrawSurface_Release(LPDDRAWI_DDRAWSURFACE_INT This) { - /* FIXME This is not right exiame how it should be done */ - DX_STUB_str("FIXME This is not right exiame how it should be done\n"); - return This->dwIntRefCnt; + ULONG ret = --This->dwIntRefCnt; + if(!ret) + { + DX_STUB_str("Release is a bit simplistic right now\n"); + AcquireDDThreadLock(); + DxHeapMemFree(This); + ReleaseDDThreadLock(); + } + return ret; } +ULONG WINAPI Main_DDrawSurface_Release4(LPDDRAWI_DDRAWSURFACE_INT This) +{ + ULONG ref = Main_DDrawSurface_Release(This) ; + + if(ref == 0) Main_DirectDraw_Release(This->lpLcl->lpSurfMore->lpDD_int); + + return ref; +} HRESULT WINAPI Main_DDrawSurface_Blt(LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT rdst, LPDDRAWI_DDRAWSURFACE_INT ThisSrc, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx) diff --git a/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c b/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c index 3041906f21c..57fd0a4e3c5 100644 --- a/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c +++ b/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c @@ -16,7 +16,7 @@ #endif ULONG WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE4); -ULONG WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE4); +ULONG WINAPI Main_DDrawSurface_Release4(LPDIRECTDRAWSURFACE4); HRESULT WINAPI Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE4, REFIID, LPVOID*); HRESULT WINAPI Main_DDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE4, HDC); HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE4, LPRECT, LPDIRECTDRAWSURFACE4, LPRECT, DWORD, LPDDBLTFX); @@ -68,7 +68,7 @@ IDirectDrawSurface4Vtbl DirectDrawSurface4_Vtable = { Main_DDrawSurface_QueryInterface, Main_DDrawSurface_AddRef, /* (Compact done) */ - Main_DDrawSurface_Release, + Main_DDrawSurface_Release4, Main_DDrawSurface_AddAttachedSurface, Main_DDrawSurface_AddOverlayDirtyRect, Main_DDrawSurface_Blt, diff --git a/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c b/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c index 97e92008ae9..07037c0ddb6 100644 --- a/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c +++ b/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c @@ -16,7 +16,7 @@ #endif ULONG WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE7); -ULONG WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE7); +ULONG WINAPI Main_DDrawSurface_Release4(LPDIRECTDRAWSURFACE7); HRESULT WINAPI Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7, REFIID, LPVOID*); HRESULT WINAPI Main_DDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7, HDC); HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX); @@ -72,7 +72,7 @@ IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable = { Main_DDrawSurface_QueryInterface, Main_DDrawSurface_AddRef, /* (Compact done) */ - Main_DDrawSurface_Release, + Main_DDrawSurface_Release4, Main_DDrawSurface_AddAttachedSurface, Main_DDrawSurface_AddOverlayDirtyRect, Main_DDrawSurface_Blt, diff --git a/reactos/dll/directx/ddraw/ddraw.rbuild b/reactos/dll/directx/ddraw/ddraw.rbuild index a678e62164e..016afa6090a 100644 --- a/reactos/dll/directx/ddraw/ddraw.rbuild +++ b/reactos/dll/directx/ddraw/ddraw.rbuild @@ -8,7 +8,7 @@ d3d8thk dxguid ole32 - user32 + uuid advapi32 pseh @@ -49,7 +49,8 @@ kernel_stubs.c - palette_stubs.c + palette.c + createpalette.c videoport_stubs.c diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index 6cb0f2088c8..9b50c1c7eda 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -34,7 +34,7 @@ extern IDirectDrawSurface4Vtbl DirectDrawSurface4_Vtable; extern IDirectDrawSurface3Vtbl DirectDrawSurface3_Vtable; extern IDirectDrawSurface2Vtbl DirectDrawSurface2_Vtable; extern IDirectDrawSurfaceVtbl DirectDrawSurface_Vtable; -extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable; +extern const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable; extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable; extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable; extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable; @@ -93,6 +93,10 @@ Internal_CreateSurface( LPDDRAWI_DDRAWSURFACE_INT *ppSurf, IUnknown *pUnkOuter); +HRESULT +Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags, + LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter); + /* convert DDSURFACEDESC to DDSURFACEDESC2 */ void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src_pDesc); diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index e1158af974a..6a5c6ba9d33 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -24,17 +24,29 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, LPDDRAWI_DIRECTDRAW_INT This; DX_WINDBG_trace(); + BOOL linking = FALSE; - if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) || - (IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW)))) + if (pIface == NULL) { return DDERR_INVALIDPARAMS; } This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; - if ( (IsBadWritePtr(This,sizeof(LPDDRAWI_DIRECTDRAW_INT)) != 0) || - (IsBadWritePtr(This->lpLcl,sizeof(LPDDRAWI_DIRECTDRAW_LCL)) != 0) ) + DX_STUB_str("Linking?\n") + + _SEH2_TRY + { + linking = This->lpLcl ? TRUE:FALSE; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + linking = FALSE; + } + _SEH2_END; + + /* fixme linking too second link when we shall not doing it */ + if (!linking) { /* We do not have a DirectDraw interface, we need alloc it*/ LPDDRAWI_DIRECTDRAW_INT memThis; @@ -310,6 +322,7 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable) return DDERR_NODIRECTDRAWSUPPORT; } dwFlags |= DDRAWI_NOHARDWARE; + DX_STUB_str("No hardware support\n"); } if (hel_ret!=DD_OK) From 7ca7ff0cbd21af0e5963d96697bd510247452ed7 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 30 Nov 2010 16:38:53 +0000 Subject: [PATCH 130/132] [CMD] - Carlo Bramix: MultiByteToWideChar() has just 6 and not 8 parameters, probably it's a forgetten copy/past from WideCharToMultiByte(). - Carlo Bramix: ConvertULargeInteger() should have its parameter 'Len' declared as UINT rather than 'INT'. This fixes a signed/unsigned mismatch warning. See issue #5678 for more details. svn path=/trunk/; revision=49873 --- reactos/base/shell/cmd/cmd.c | 2 +- reactos/base/shell/cmd/cmd.h | 2 +- reactos/base/shell/cmd/console.c | 2 +- reactos/base/shell/cmd/precomp.h | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c index 09f362d73af..1c63be6e5e1 100644 --- a/reactos/base/shell/cmd/cmd.c +++ b/reactos/base/shell/cmd/cmd.c @@ -180,7 +180,7 @@ WORD wDefColor; /* default color */ * insert commas into a number */ INT -ConvertULargeInteger(ULONGLONG num, LPTSTR des, INT len, BOOL bPutSeperator) +ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeperator) { TCHAR temp[39]; /* maximum length with nNumberGroups == 1 */ UINT n, iTarget; diff --git a/reactos/base/shell/cmd/cmd.h b/reactos/base/shell/cmd/cmd.h index c6605de480f..9344ac9372f 100644 --- a/reactos/base/shell/cmd/cmd.h +++ b/reactos/base/shell/cmd/cmd.h @@ -99,7 +99,7 @@ INT cmd_cls (LPTSTR); /* Prototypes for CMD.C */ -INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, INT len, BOOL bPutSeperator); +INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeperator); HANDLE RunFile(DWORD, LPTSTR, LPTSTR, LPTSTR, INT); INT ParseCommandLine(LPTSTR); struct _PARSED_COMMAND; diff --git a/reactos/base/shell/cmd/console.c b/reactos/base/shell/cmd/console.c index 8184af747ea..e5830586305 100644 --- a/reactos/base/shell/cmd/console.c +++ b/reactos/base/shell/cmd/console.c @@ -131,7 +131,7 @@ static VOID ConWrite(TCHAR *str, DWORD len, DWORD nStdHandle) error_out_of_memory(); return; } - len = MultiByteToWideChar(OutputCodePage, 0, str, len, buffer, len, NULL, NULL); + len = MultiByteToWideChar(OutputCodePage, 0, str, len, buffer, len); str = (PVOID)buffer; #endif WriteFile(hOutput, str, len * sizeof(WCHAR), &dwWritten, NULL); diff --git a/reactos/base/shell/cmd/precomp.h b/reactos/base/shell/cmd/precomp.h index 915246cceb8..3eb404b69c4 100644 --- a/reactos/base/shell/cmd/precomp.h +++ b/reactos/base/shell/cmd/precomp.h @@ -23,6 +23,7 @@ #include #include #include +#include #define NTOS_MODE_USER #include From ed5da47acdff9e0b20ea47414d97e5d6f7dd8bd6 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 30 Nov 2010 19:14:41 +0000 Subject: [PATCH 131/132] [FINDSTR] - Port findstr (incomplete, as author of this patch states, it may satisfy RosBE, .c .h and .rc files) from FreeDOS project. Needed for RosBE-on-ReactOS support. See issue #5724 for more details. svn path=/trunk/; revision=49875 --- reactos/base/applications/applications.rbuild | 3 + reactos/base/applications/findstr/findstr.c | 295 ++++++++++++++++++ .../base/applications/findstr/findstr.rbuild | 8 + reactos/base/applications/findstr/findstr.rc | 6 + .../base/applications/findstr/lang/bg-BG.rc | 17 + .../base/applications/findstr/lang/ca-ES.rc | 17 + .../base/applications/findstr/lang/cs-CZ.rc | 23 ++ .../base/applications/findstr/lang/de-DE.rc | 17 + .../base/applications/findstr/lang/el-GR.rc | 17 + .../base/applications/findstr/lang/en-US.rc | 17 + .../base/applications/findstr/lang/es-ES.rc | 17 + .../base/applications/findstr/lang/fr-FR.rc | 17 + .../base/applications/findstr/lang/it-IT.rc | 17 + .../base/applications/findstr/lang/lt-LT.rc | 26 ++ .../base/applications/findstr/lang/no-NO.rc | 17 + .../base/applications/findstr/lang/pl-PL.rc | 24 ++ .../base/applications/findstr/lang/pt-BR.rc | 17 + .../base/applications/findstr/lang/ru-RU.rc | 17 + .../base/applications/findstr/lang/sk-SK.rc | 21 ++ .../base/applications/findstr/lang/sv-SE.rc | 17 + .../base/applications/findstr/lang/uk-UA.rc | 25 ++ reactos/base/applications/findstr/resource.h | 3 + reactos/base/applications/findstr/rsrc.rc | 20 ++ reactos/boot/bootdata/packages/reactos.dff | 1 + 24 files changed, 659 insertions(+) create mode 100644 reactos/base/applications/findstr/findstr.c create mode 100644 reactos/base/applications/findstr/findstr.rbuild create mode 100644 reactos/base/applications/findstr/findstr.rc create mode 100644 reactos/base/applications/findstr/lang/bg-BG.rc create mode 100644 reactos/base/applications/findstr/lang/ca-ES.rc create mode 100644 reactos/base/applications/findstr/lang/cs-CZ.rc create mode 100644 reactos/base/applications/findstr/lang/de-DE.rc create mode 100644 reactos/base/applications/findstr/lang/el-GR.rc create mode 100644 reactos/base/applications/findstr/lang/en-US.rc create mode 100644 reactos/base/applications/findstr/lang/es-ES.rc create mode 100644 reactos/base/applications/findstr/lang/fr-FR.rc create mode 100644 reactos/base/applications/findstr/lang/it-IT.rc create mode 100644 reactos/base/applications/findstr/lang/lt-LT.rc create mode 100644 reactos/base/applications/findstr/lang/no-NO.rc create mode 100644 reactos/base/applications/findstr/lang/pl-PL.rc create mode 100644 reactos/base/applications/findstr/lang/pt-BR.rc create mode 100644 reactos/base/applications/findstr/lang/ru-RU.rc create mode 100644 reactos/base/applications/findstr/lang/sk-SK.rc create mode 100644 reactos/base/applications/findstr/lang/sv-SE.rc create mode 100644 reactos/base/applications/findstr/lang/uk-UA.rc create mode 100644 reactos/base/applications/findstr/resource.h create mode 100644 reactos/base/applications/findstr/rsrc.rc diff --git a/reactos/base/applications/applications.rbuild b/reactos/base/applications/applications.rbuild index 232b44c0868..0a1265ce571 100644 --- a/reactos/base/applications/applications.rbuild +++ b/reactos/base/applications/applications.rbuild @@ -22,6 +22,9 @@ + + + diff --git a/reactos/base/applications/findstr/findstr.c b/reactos/base/applications/findstr/findstr.c new file mode 100644 index 00000000000..681bff7ee53 --- /dev/null +++ b/reactos/base/applications/findstr/findstr.c @@ -0,0 +1,295 @@ +/* findstr.c */ + +/* Copyright (C) 1994-2002, Jim Hall */ + +/* Adapted for ReactOS -Edited for Findstr.exe K'Williams */ + +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + + +/* This program locates a string in a text file and prints those lines + * that contain the string. Multiple files are clearly separated. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include "resource.h" + + +/* Symbol definition */ +#define MAX_STR 1024 + + +/* This function prints out all lines containing a substring. There are some + * conditions that may be passed to the function. + * + * RETURN: If the string was found at least once, returns 1. + * If the string was not found at all, returns 0. + */ +int +find_str (char *sz, FILE *p, int invert_search, + int count_lines, int number_output, int ignore_case, int at_start, int literal_search, + int at_end, int reg_express, int exact_match, int sub_dirs, int only_fname) +{ + int i, length; + long line_number = 0, total_lines = 0; + char *c, temp_str[MAX_STR], this_line[MAX_STR]; + + /* Convert to upper if needed */ + if (ignore_case) + { + length = strlen (sz); + for (i = 0; i < length; i++) + sz[i] = toupper (sz[i]); + } + + /* Scan the file until EOF */ + while (fgets (temp_str, MAX_STR, p) != NULL) + { + /* Remove the trailing newline */ + length = strlen (temp_str); + if (temp_str[length-1] == '\n') + { + temp_str[length-1] = '\0'; + } + + /* Increment number of lines */ + line_number++; + strcpy (this_line, temp_str); + + /* Convert to upper if needed */ + if (ignore_case) + { + for (i = 0; i < length; i++) + { + temp_str[i] = toupper (temp_str[i]); + } + } + + /* Locate the substring */ + + /* strstr() returns a pointer to the first occurrence in the + string of the substring */ + c = strstr (temp_str, sz); + + if ( ((invert_search) ? (c == NULL) : (c != NULL)) ) + { + if (!count_lines) + { + if (number_output) + printf ("%ld:", line_number); + + /* Print the line of text */ + puts (this_line); + } + + total_lines++; + } /* long if */ + } /* while fgets */ + + if (count_lines) + { + /* Just show num. lines that contain the string */ + printf ("%ld\n", total_lines); + } + + + /* RETURN: If the string was found at least once, returns 1. + * If the string was not found at all, returns 0. + */ + return (total_lines > 0 ? 1 : 0); +} + +/* Show usage */ +void +usage (void) +{ + TCHAR lpUsage[4096]; + + LoadString( GetModuleHandle(NULL), IDS_USAGE, (LPTSTR)lpUsage, 4096); + CharToOem(lpUsage, lpUsage); + printf( lpUsage ); +} + + +/* Main program */ +int +main (int argc, char **argv) +{ + char *opt, *needle = NULL; + int ret = 0; + TCHAR lpMessage[4096]; + + int invert_search = 0; /* flag to invert the search */ + int count_lines = 0; /* flag to whether/not count lines */ + int number_output = 0; /* flag to print line numbers */ + int ignore_case = 0; /* flag to be case insensitive */ + int at_start = 0; /* flag to Match if at the beginning of a line. */ + int at_end = 0; /* flag to Match if at the beginning of a line. */ + int reg_express = 0; /* flag to use/not use regular expressions */ + int exact_match = 0; /* flag to be exact match */ + int sub_dirs= 0; /* this and all subdirectories */ + int only_fname= 0; /* print only the name of the file*/ + int literal_search=0; + + FILE *pfile; /* file pointer */ + int hfind; /* search handle */ + struct _finddata_t finddata; /* _findfirst, filenext block */ + + /* Scan the command line */ + while ((--argc) && (needle == NULL)) + { + if (*(opt = *++argv) == '/') + { + switch (opt[1]) + { + case 'b': + case 'B': /* Matches pattern if at the beginning of a line */ + at_start = 1; + break; + + //case 'c': + //case 'C': /* Literal? */ + // literal_search = 1; + // break; + + case 'e': + case 'E': /* matches pattern if at end of line */ + at_end = 1; + break; + + case 'i': + case 'I': /* Ignore */ + ignore_case = 1; + break; + + case 'm': + case 'M': /* only filename */ + only_fname = 1; + break; + + case 'n': + case 'N': /* Number */ + number_output = 1; + break; + + case 'r': + case 'R': /* search strings as regular expressions */ + reg_express = 1; + break; + + case 's': + case 'S': /* search files in child directory too*/ + sub_dirs = 1; + break; + + case 'v': + case 'V': /* Not with */ + invert_search = 1; + break; + + case 'x': + case 'X': /* exact match */ + exact_match = 1; + break; + + default: + usage (); + exit (2); /* syntax error .. return error 2 */ + break; + } + } + else + { + /* Get the string */ + if (needle == NULL) + { + /* Assign the string to find */ + needle = *argv; + } + } + } + + /* Check for search string */ + if (needle == NULL) + { + /* No string? */ + usage (); + exit (1); + } + + /* Scan the files for the string */ + if (argc == 0) + { + ret = find_str (needle, stdin, invert_search, count_lines, + number_output, ignore_case, at_start, literal_search, at_end, reg_express, exact_match, + sub_dirs, only_fname); + } + + while (--argc >= 0) + { + hfind = _findfirst (*++argv, &finddata); + if (hfind < 0) + { + /* We were not able to find a file. Display a message and + set the exit status. */ + LoadString( GetModuleHandle(NULL), IDS_NO_SUCH_FILE, (LPTSTR)lpMessage, 4096); + CharToOem(lpMessage, lpMessage); + fprintf (stderr, lpMessage, *argv);// + } + else + { + /* repeat find next file to match the filemask */ + do + { + /* We have found a file, so try to open it */ + if ((pfile = fopen (finddata.name, "r")) != NULL) + { + printf ("---------------- %s\n", finddata.name); + ret = find_str (needle, pfile, invert_search, count_lines, + number_output, ignore_case, at_start, literal_search, at_end, reg_express, exact_match, + sub_dirs, only_fname); + fclose (pfile); + } + else + { + LoadString(GetModuleHandle(NULL), IDS_CANNOT_OPEN, (LPTSTR)lpMessage, 4096); + CharToOem(lpMessage, lpMessage); + fprintf (stderr, lpMessage, + finddata.name); + } + } + while (_findnext(hfind, &finddata) > 0); + } + _findclose(hfind); + } /* for each argv */ + + /* RETURN: If the string was found at least once, returns 0. + * If the string was not found at all, returns 1. + * (Note that find_str.c returns the exact opposite values.) + */ + exit ( (ret ? 0 : 1) ); +} + + diff --git a/reactos/base/applications/findstr/findstr.rbuild b/reactos/base/applications/findstr/findstr.rbuild new file mode 100644 index 00000000000..64306e39df8 --- /dev/null +++ b/reactos/base/applications/findstr/findstr.rbuild @@ -0,0 +1,8 @@ + + + + user32 + findstr.c + findstr.rc + rsrc.rc + diff --git a/reactos/base/applications/findstr/findstr.rc b/reactos/base/applications/findstr/findstr.rc new file mode 100644 index 00000000000..8d50fbaa345 --- /dev/null +++ b/reactos/base/applications/findstr/findstr.rc @@ -0,0 +1,6 @@ +#define REACTOS_STR_FILE_DESCRIPTION "W32 findstr command\0" +#define REACTOS_STR_INTERNAL_NAME "findstr\0" +#define REACTOS_STR_ORIGINAL_FILENAME "findstr.exe\0" +#include + +#include "rsrc.rc" diff --git a/reactos/base/applications/findstr/lang/bg-BG.rc b/reactos/base/applications/findstr/lang/bg-BG.rc new file mode 100644 index 00000000000..3f7cd7fde86 --- /dev/null +++ b/reactos/base/applications/findstr/lang/bg-BG.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Èçâåæäà âñè÷êè ðåäîâå âúâ ôàéëà, êîèòî ñúäúðæàò óêàçàíèÿ íèç..\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"íèç\" [ ôàéë... ]\n\ + /C Áðîè êîëêî ðåäà ñúäúðæàò íèçà\n\ + /I Ïðåíåáðåãâà ÃëÀâÍÎñÒòà\n\ + /N Áðîé ïîêàçàíè ðåäîâå, êàòî ñå çàïî÷âà îò 1\n\ + /V Èçâåæäàíå íà ðåäîâåòå, ÍÅñúäúðæàùè íèçà." + +IDS_NO_SUCH_FILE, "FIND: %s: Íÿìà òàêúâ ôàéë\n" + +IDS_CANNOT_OPEN, "FIND: %s: Îòâàðÿíåòî íà ôàéëà å íåâúçìîæíî\n" + +END diff --git a/reactos/base/applications/findstr/lang/ca-ES.rc b/reactos/base/applications/findstr/lang/ca-ES.rc new file mode 100644 index 00000000000..932d4bc06bc --- /dev/null +++ b/reactos/base/applications/findstr/lang/ca-ES.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_CATALAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Mostra totes les linies que continguin una determinada cadena de caràcters.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"Cadena de caràcters\" [ file... ]\n\ + /C Conta el numero de linies que contenen la cadena de caràcters\n\ + /I Ignora majúscules i minúscules\n\ + /N Numero de linies mostrades, començant per la primera\n\ + /V Mostra les linies que no contenen la cadena de caràcters" + +IDS_NO_SUCH_FILE, "FIND: %s: No he trobat el fitxer\n" + +IDS_CANNOT_OPEN, "FIND: %s: No puc obrir el fitxer\n" + +END diff --git a/reactos/base/applications/findstr/lang/cs-CZ.rc b/reactos/base/applications/findstr/lang/cs-CZ.rc new file mode 100644 index 00000000000..8a41024c73b --- /dev/null +++ b/reactos/base/applications/findstr/lang/cs-CZ.rc @@ -0,0 +1,23 @@ +/* FILE: applications/cmdutils/find/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * THANKS TO: Mario Kacmar aka Kario (kario@szm.sk) + * UPDATED: 2008-02-29 + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Zobrazí všechny øádky souboru obsahující hledaný øetìzec.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"øetìzec\" [ soubor... ]\n\ + /C Zobrazí poèet øádkù obsahující øetìzec.\n\ + /I Ignoruje velikost písmen.\n\ + /N Èísluje zobrazené øádky, zaèíná od 1.\n\ + /V Zobrazí všechny øádky, které NEobsahují zadaný øetìžec." + +IDS_NO_SUCH_FILE, "FIND: Soubor %s nebyl nalezen.\n" + +IDS_CANNOT_OPEN, "FIND: Soubor %s nelze otevøít!\n" + +END diff --git a/reactos/base/applications/findstr/lang/de-DE.rc b/reactos/base/applications/findstr/lang/de-DE.rc new file mode 100644 index 00000000000..1663cc7aff7 --- /dev/null +++ b/reactos/base/applications/findstr/lang/de-DE.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "Sucht in einer Datei nach einer Zeichenfolge.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"string\" [ file... ]\n\ + /C Zeigt nur die Anzahl der die Zeichenfolge enthaltenen Zeilen an.\n\ + /I Ignoriert Groß-/Kleinbuchstaben bei der Suche.\n\ + /N Zeigt die Zeilen mit ihren Zeilennummern an.\n\ + /V Zeigt alle Zeilen an, die die Zeichenfolge NICHT enhalten." + +IDS_NO_SUCH_FILE, "Datei %s nicht gefunden\n" + +IDS_CANNOT_OPEN, "Datei %s kann nicht geöffnet werden.\n" + +END diff --git a/reactos/base/applications/findstr/lang/el-GR.rc b/reactos/base/applications/findstr/lang/el-GR.rc new file mode 100644 index 00000000000..19e993dda46 --- /dev/null +++ b/reactos/base/applications/findstr/lang/el-GR.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Åêôõðþíåé üëåò ôéò ãñáììÝò åíüò áñ÷åßïõ ðïõ ðåñéÝ÷ïõí Ýíá áëöáñéèìçôéêü.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"áëöáñéèìçôéêü\" [ áñ÷åßï... ]\n\ + /C ÌÝôñçóç ãñáììþí ðïõ ðåñéÝ÷ïõí ôï áëöáñéèìçôéêü\n\ + /I Áãíüçóç êåöáëáßùí\n\ + /N ÅìöÜíéóç áñéèìþí óôéò åìöáíéæüìåíåò ãñáììÝò, îåêéíþíôáò áðü ôï 1\n\ + /V Åêôýðùóç ãñáììþí ðïõ äåí ðåñéÝ÷ïõí ôï áëöáñéèìçôéêü" + +IDS_NO_SUCH_FILE, "FIND: %s: Äåí õðÜñ÷åé áõôü ôï áñ÷åßï\n" + +IDS_CANNOT_OPEN, "FIND: %s: Äåí Þôáí äõíáôü ôï Üíïéãìá ôïõ áñ÷åßïõ\n" + +END diff --git a/reactos/base/applications/findstr/lang/en-US.rc b/reactos/base/applications/findstr/lang/en-US.rc new file mode 100644 index 00000000000..d4ebfe38d53 --- /dev/null +++ b/reactos/base/applications/findstr/lang/en-US.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FINDSTR: Prints all lines of a file that contain a string.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"string\" [ file... ]\n\ + /C Count the number of lines that contain string\n\ + /I Ignore case\n\ + /N Number the displayed lines, starting at 1\n\ + /V Print lines that do not contain the string" + +IDS_NO_SUCH_FILE, "FINDSTR: %s: No such file\n" + +IDS_CANNOT_OPEN, "FINDSTR: %s: Cannot open file\n" + +END diff --git a/reactos/base/applications/findstr/lang/es-ES.rc b/reactos/base/applications/findstr/lang/es-ES.rc new file mode 100644 index 00000000000..f2fee3f0a4b --- /dev/null +++ b/reactos/base/applications/findstr/lang/es-ES.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Imprime todas las líneas de un fichero que contiene una cadena.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"cadena\" [ fichero... ]\n\ + /C Cuenta el número de líneas que contienen la cadena de caracteres\n\ + /I Ignora mayúsculas y minúsculas\n\ + /N Numero de líneas a mostrar en pantalla, a partir de la primera\n\ + /V Muestra las líneas que no contienen la cadena de caracteres." + +IDS_NO_SUCH_FILE, "FIND: %s: No se encontró el fichero\n" + +IDS_CANNOT_OPEN, "FIND: %s: No se pudo abrir el fichero\n" + +END diff --git a/reactos/base/applications/findstr/lang/fr-FR.rc b/reactos/base/applications/findstr/lang/fr-FR.rc new file mode 100644 index 00000000000..076f0930177 --- /dev/null +++ b/reactos/base/applications/findstr/lang/fr-FR.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Affiche toutes les lignes d'un fichier qui contiennent un morceau de texte.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"texte\" [ fichier... ]\n\ + /C Compte le nombre de lignes qui contiennent le texte\n\ + /I Insensible à la casse\n\ + /N Numérote les lignes affichées en commençant à 1\n\ + /V Affiche les lignes qui ne contiennent pas le texte" + +IDS_NO_SUCH_FILE, "FIND: %s : fichier inexistant\n" + +IDS_CANNOT_OPEN, "FIND: %s : impossible d'ouvrir le fichier\n" + +END diff --git a/reactos/base/applications/findstr/lang/it-IT.rc b/reactos/base/applications/findstr/lang/it-IT.rc new file mode 100644 index 00000000000..d0dabd405f2 --- /dev/null +++ b/reactos/base/applications/findstr/lang/it-IT.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Visualizza le linee di un file che contengono un stringa.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"stringa\" [ file... ]\n\ + /C Conta il numero di linee che contengono la stringa\n\ + /I Ignora maiuscole/minuscole\n\ + /N Numera le linee visualizzate a partire da 1\n\ + /V Visualizza le linee che non contengono la stringa" + +IDS_NO_SUCH_FILE, "FIND: %s: File non trovato\n" + +IDS_CANNOT_OPEN, "FIND: %s: Impossibile aprire il file\n" + +END diff --git a/reactos/base/applications/findstr/lang/lt-LT.rc b/reactos/base/applications/findstr/lang/lt-LT.rc new file mode 100644 index 00000000000..ce5b86af08a --- /dev/null +++ b/reactos/base/applications/findstr/lang/lt-LT.rc @@ -0,0 +1,26 @@ +/* + * PROJECT: ReactOS find command + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/cmdutils/find/lang/lt-LT.rc + * PURPOSE: Lithuanian Language File + * TRANSLATOR: Vytis "CMan" Girdþijauskas (cman@cman.us) + * DATE: 2007-09-23 + */ + +LANGUAGE LANG_LITHUANIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Spausdina visas bylos eilutes, kuriose yra ieðkomas tekstas.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"tekstas\" [ byla... ]\n\ + /C Skaièiuoti eilutes, kuriose yra ieðkomas tekstas\n\ + /I Ignoruoti raidþiø dydá\n\ + /N Numeruoti vaizduojamas eilutes, pradedant nuo 1\n\ + /V Spausdinti eilutes, kuriose nëra ieðkomo teksto" + +IDS_NO_SUCH_FILE, "FIND: %s: Tokios bylos nëra\n" + +IDS_CANNOT_OPEN, "FIND: %s: Nepavyko atverti bylos\n" + +END diff --git a/reactos/base/applications/findstr/lang/no-NO.rc b/reactos/base/applications/findstr/lang/no-NO.rc new file mode 100644 index 00000000000..d564684f86f --- /dev/null +++ b/reactos/base/applications/findstr/lang/no-NO.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FINN: Skriv alle linjene for filen som inneholder en streng.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"streng\" [ fil... ]\n\ + /C Teller nummer av linjer som inneholder strenger\n\ + /I Ignorere sak\n\ + /N Nummer viste linjer, start med 1\n\ + /V Skriv linjer som ikke inneholder en streng" + +IDS_NO_SUCH_FILE, "FINN: %s: Ingen filer\n" + +IDS_CANNOT_OPEN, "FINN: %s: Kan ikke åpne filen\n" + +END diff --git a/reactos/base/applications/findstr/lang/pl-PL.rc b/reactos/base/applications/findstr/lang/pl-PL.rc new file mode 100644 index 00000000000..744623e2aa4 --- /dev/null +++ b/reactos/base/applications/findstr/lang/pl-PL.rc @@ -0,0 +1,24 @@ +/* + * translated by Caemyr - Olaf Siejka (Dec,2007) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Wyœwietla wszystkie linie danego pliku, zawieraj¹ce szukany ci¹g znaków.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"ci¹g znaków\" [ plik... ]\n\ + /C Oblicza w ilu liniach pojawi³ siê szukany ci¹g znaków\n\ + /I Ignoruje wielkoœæ liter\n\ + /N Numeruje wyœwietlane linie, zaczynaj¹c od 1\n\ + /V Wyœwietla te linie które nie zawieraj¹ szukanego ci¹gu znaków" + +IDS_NO_SUCH_FILE, "FIND: %s: Plik nie zosta³ znaleziony\n" + +IDS_CANNOT_OPEN, "FIND: %s: Nie mo¿na otworzyæ pliku\n" + +END diff --git a/reactos/base/applications/findstr/lang/pt-BR.rc b/reactos/base/applications/findstr/lang/pt-BR.rc new file mode 100644 index 00000000000..de6342b71b3 --- /dev/null +++ b/reactos/base/applications/findstr/lang/pt-BR.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Localiza uma seqüência de texto em um ou mais arquivos.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"seqüência\" [ arquivo... ]\n\ + /C Exibe apenas o número de linhas que contêm a seqüência.\n\ + /I Ignora maiúsculas/minúsculas ao localizar uma seqüência.\n\ + /N Exibe o número de cada linha, iniciando no 1.\n\ + /V Exibe todas as linhas que NÃO contêm a seqüência especificada." + +IDS_NO_SUCH_FILE, "FIND: %s: Arquivo não encontrado\n" + +IDS_CANNOT_OPEN, "FIND: %s: Não foi possível abrir o arquivo\n" + +END diff --git a/reactos/base/applications/findstr/lang/ru-RU.rc b/reactos/base/applications/findstr/lang/ru-RU.rc new file mode 100644 index 00000000000..94594f56770 --- /dev/null +++ b/reactos/base/applications/findstr/lang/ru-RU.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Ïîèñê òåêñòîâîé ñòðîêè â îäíîì èëè íåñêîëüêèõ ôàéëàõ.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"ñòðîêà\" [ ôàéë... ]\n\ + /C Âûâîä òîëüêî îáùåãî ÷èñëà ñòðîê, ñîäåðæàùèõ çàäàííóþ ñòðîêó.\n\ + /I Ïîèñê áåç ó÷åòà ðåãèñòðà ñèìâîëîâ.\n\ + /N Âûâîä íîìåðîâ îòîáðàæàåìûõ ñòðîê (íà÷èíàÿ ñ 1).\n\ + /V Âûâîä âñåõ ñòðîê, ÍÅ ñîäåðæàùèõ çàäàííóþ ñòðîêó." + +IDS_NO_SUCH_FILE, "FIND: %s: Ôàéë íå ñóùåñòâóåò.\n" + +IDS_CANNOT_OPEN, "FIND: %s: Íåâîçìîæíî îòêðûòü ôàéë.\n" + +END diff --git a/reactos/base/applications/findstr/lang/sk-SK.rc b/reactos/base/applications/findstr/lang/sk-SK.rc new file mode 100644 index 00000000000..93037288a93 --- /dev/null +++ b/reactos/base/applications/findstr/lang/sk-SK.rc @@ -0,0 +1,21 @@ +/* TRANSLATOR: M rio KaŸm r /Mario Kacmar/ aka Kario (kario@szm.sk) + * DATE OF TR: 12-02-2008 + */ + +LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Zobraz¡ vçetky riadky s£boru obsahuj£ce h–adanì reœazec.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"reœazec\" [ s£bor... ]\n\ + /C Zobraz¡ poŸet riadkov, ktor‚ obsahuj£ reœazec.\n\ + /I Ignoruje ve–kosœ p¡smen.\n\ + /N ¬¡sluje zobrazen‚ riadky, zaŸ¡na od 1.\n\ + /V Zobraz¡ vçetky riadky, ktor‚ neobsahuj£ h–adanì reœazec." + +IDS_NO_SUCH_FILE, "FIND: S£bor %s sa nenaçiel.\n" + +IDS_CANNOT_OPEN, "FIND: S£bor %s sa ned  otvoriœ.\n" + +END diff --git a/reactos/base/applications/findstr/lang/sv-SE.rc b/reactos/base/applications/findstr/lang/sv-SE.rc new file mode 100644 index 00000000000..e8d0d6eefdc --- /dev/null +++ b/reactos/base/applications/findstr/lang/sv-SE.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Skriver ut alla rader i en fil som innehåller en sträng.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"sträng\" [ fil... ]\n\ + /C Räkna nummren av linjer som innehåller en strängen\n\ + /I Ignorera skiftläge\n\ + /N Antal visade rader, börjar på 1\n\ + /V Skriver ut rader som inte innehåller strängen" + +IDS_NO_SUCH_FILE, "FIND: %s: Ingen sorts fil\n" + +IDS_CANNOT_OPEN, "FIND: %s: Kan inte öppna filen\n" + +END diff --git a/reactos/base/applications/findstr/lang/uk-UA.rc b/reactos/base/applications/findstr/lang/uk-UA.rc new file mode 100644 index 00000000000..b7df8b4e635 --- /dev/null +++ b/reactos/base/applications/findstr/lang/uk-UA.rc @@ -0,0 +1,25 @@ +/* + * PROJECT: Find + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/cmdutils/find/lang/uk-UA.rc + * PURPOSE: Ukraianian Language File for find + * TRANSLATOR: Artem Reznikov + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: Âèâåäåííÿ âñ³õ ðÿäê³â ôàéëó, ÿê³ ì³ñòÿòü ðÿäîê.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] \"ðÿäîê\" [ ôàéë... ]\n\ + /C Ïîðàõóâàòè ê³ëüê³ñòü ðÿäê³â, ÿê³ ì³ñòÿòü ðÿäîê\n\ + /I Íå âðàõîâóâàòè ðåã³ñòð ñèìâîë³â\n\ + /N Íóìåðóâàòè ðÿäêè, ÿê³ â³äîáðàæàþòüñÿ (ïî÷èíàþ÷è ç 1)\n\ + /V Âèâåäåííÿ ðÿäê³â, ÿê³ íå ì³ñòÿòü çàäàíèé ðÿäîê" + +IDS_NO_SUCH_FILE, "FIND: %s: Ôàéë íå ³ñíóº\n" + +IDS_CANNOT_OPEN, "FIND: %s: Íåìîæëèâî â³äêðèòè ôàéë\n" + +END diff --git a/reactos/base/applications/findstr/resource.h b/reactos/base/applications/findstr/resource.h new file mode 100644 index 00000000000..444cd8cc457 --- /dev/null +++ b/reactos/base/applications/findstr/resource.h @@ -0,0 +1,3 @@ +#define IDS_USAGE 1000 +#define IDS_NO_SUCH_FILE 1001 +#define IDS_CANNOT_OPEN 1002 diff --git a/reactos/base/applications/findstr/rsrc.rc b/reactos/base/applications/findstr/rsrc.rc new file mode 100644 index 00000000000..99baec73cbe --- /dev/null +++ b/reactos/base/applications/findstr/rsrc.rc @@ -0,0 +1,20 @@ +#include +#include "resource.h" + +#include "lang/bg-BG.rc" +#include "lang/ca-ES.rc" +#include "lang/cs-CZ.rc" +#include "lang/de-DE.rc" +#include "lang/el-GR.rc" +#include "lang/en-US.rc" +#include "lang/es-ES.rc" +#include "lang/fr-FR.rc" +#include "lang/it-IT.rc" +#include "lang/lt-LT.rc" +#include "lang/no-NO.rc" +#include "lang/pl-PL.rc" +#include "lang/pt-BR.rc" +#include "lang/ru-RU.rc" +#include "lang/sk-SK.rc" +#include "lang/sv-SE.rc" +#include "lang/uk-UA.rc" diff --git a/reactos/boot/bootdata/packages/reactos.dff b/reactos/boot/bootdata/packages/reactos.dff index f08fb2489c0..778dac88b98 100644 --- a/reactos/boot/bootdata/packages/reactos.dff +++ b/reactos/boot/bootdata/packages/reactos.dff @@ -45,6 +45,7 @@ base\applications\cmdutils\xcopy\xcopy.exe 1 base\applications\control\control.exe 1 base\applications\dxdiag\dxdiag.exe 1 base\applications\extrac32\extrac32.exe 1 +base\applications\findstr\findstr.exe 1 base\applications\fontview\fontview.exe 1 base\applications\games\solitaire\sol.exe 1 base\applications\games\spider\spider.exe 1 From 1a20b0bd9c66342cc8135a22b186556f17d4e77c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 2 Dec 2010 14:37:16 +0000 Subject: [PATCH 132/132] [NTOSKRNL] patch by Samuel Serapion: Implement MemorySectionName case for NtQueryVirtualMemory. Protect buffer access with SEH. See issue #5753 for more details. svn path=/trunk/; revision=49898 --- reactos/ntoskrnl/mm/ARM3/virtual.c | 250 +++++++++++++++++++++++++---- 1 file changed, 215 insertions(+), 35 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/virtual.c b/reactos/ntoskrnl/mm/ARM3/virtual.c index 4e69411f864..508db86b1e2 100644 --- a/reactos/ntoskrnl/mm/ARM3/virtual.c +++ b/reactos/ntoskrnl/mm/ARM3/virtual.c @@ -2339,35 +2339,21 @@ NtResetWriteWatch(IN HANDLE ProcessHandle, NTSTATUS NTAPI -NtQueryVirtualMemory(IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN MEMORY_INFORMATION_CLASS MemoryInformationClass, - OUT PVOID MemoryInformation, - IN SIZE_T MemoryInformationLength, - OUT PSIZE_T ReturnLength) +MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + OUT PVOID MemoryInformation, + IN SIZE_T MemoryInformationLength, + OUT PSIZE_T ReturnLength) { PEPROCESS TargetProcess; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; PMMVAD Vad = NULL; PVOID Address, NextAddress; BOOLEAN Found = FALSE; ULONG NewProtect, NewState, BaseVpn; MEMORY_BASIC_INFORMATION MemoryInfo; KAPC_STATE ApcState; - DPRINT("Querying class %d about address: %p\n", MemoryInformationClass, BaseAddress); - - /* Only this class is supported for now */ - ASSERT(MemoryInformationClass == MemoryBasicInformation); - - /* Validate the size information of the class */ - if (MemoryInformationLength < sizeof(MEMORY_BASIC_INFORMATION)) - { - /* The size is invalid */ - return STATUS_INFO_LENGTH_MISMATCH; - } - - /* Bail out if the address is invalid */ - if (BaseAddress > MM_HIGHEST_USER_ADDRESS) return STATUS_INVALID_PARAMETER; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); /* Check for illegal addresses in user-space, or the shared memory area */ if ((BaseAddress > MM_HIGHEST_VAD_ADDRESS) || @@ -2396,11 +2382,27 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle, MemoryInfo.RegionSize = (ULONG_PTR)MemoryInfo.AllocationBase - (ULONG_PTR)Address; } - /* Return the data (FIXME: Use SEH) */ - *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; - if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + /* Return the data, NtQueryInformation already probed it*/ + if (PreviousMode != KernelMode) + { + _SEH2_TRY + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + } + else + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } - return STATUS_SUCCESS; + return Status; } /* Check if this is for a local or remote process */ @@ -2507,11 +2509,27 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle, MemoryInfo.Protect = PAGE_NOACCESS; MemoryInfo.Type = 0; - /* Return the data (FIXME: Use SEH) */ - *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; - if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + /* Return the data, NtQueryInformation already probed it*/ + if (PreviousMode != KernelMode) + { + _SEH2_TRY + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + } + else + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } - return STATUS_SUCCESS; + return Status; } /* This must be a VM VAD */ @@ -2539,7 +2557,7 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle, Address = NextAddress; } - /* Now that we know the last VA address, calculate hte region size */ + /* Now that we know the last VA address, calculate the region size */ MemoryInfo.RegionSize = ((ULONG_PTR)Address - (ULONG_PTR)MemoryInfo.BaseAddress); /* Check if we were attached */ @@ -2550,17 +2568,179 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle, ObDereferenceObject(TargetProcess); } - /* Return the data (FIXME: Use SEH) */ - *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; - if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); - + /* Return the data, NtQueryInformation already probed it*/ + if (PreviousMode != KernelMode) + { + _SEH2_TRY + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + } + else + { + *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo; + if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION); + } + /* All went well */ DPRINT("Base: %p AllocBase: %p Protect: %lx AllocProtect: %lx " "State: %lx Type: %lx Size: %lx\n", MemoryInfo.BaseAddress, MemoryInfo.AllocationBase, MemoryInfo.AllocationProtect, MemoryInfo.Protect, MemoryInfo.State, MemoryInfo.Type, MemoryInfo.RegionSize); - return STATUS_SUCCESS; + + return Status; +} + +NTSTATUS +NTAPI +MiQueryMemorySectionName(IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + OUT PVOID MemoryInformation, + IN SIZE_T MemoryInformationLength, + OUT PSIZE_T ReturnLength) +{ + PEPROCESS Process; + NTSTATUS Status; + WCHAR ModuleFileNameBuffer[MAX_PATH] = {0}; + UNICODE_STRING ModuleFileName; + PMEMORY_SECTION_NAME SectionName = NULL; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_QUERY_INFORMATION, + NULL, + PreviousMode, + (PVOID*)(&Process), + NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT("MiQueryMemorySectionName: ObReferenceObjectByHandle returned %x\n",Status); + return Status; + } + + RtlInitEmptyUnicodeString(&ModuleFileName, ModuleFileNameBuffer, sizeof(ModuleFileNameBuffer)); + Status = MmGetFileNameForAddress(BaseAddress, &ModuleFileName); + + if (NT_SUCCESS(Status)) + { + SectionName = MemoryInformation; + if (PreviousMode != KernelMode) + { + _SEH2_TRY + { + RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer); + SectionName->SectionFileName.MaximumLength = MemoryInformationLength; + RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName); + + if (ReturnLength) *ReturnLength = ModuleFileName.Length; + + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + } + else + { + RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer); + SectionName->SectionFileName.MaximumLength = MemoryInformationLength; + RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName); + + if (ReturnLength) *ReturnLength = ModuleFileName.Length; + + } + } + ObDereferenceObject(Process); + return Status; +} + +NTSTATUS +NTAPI +NtQueryVirtualMemory(IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN MEMORY_INFORMATION_CLASS MemoryInformationClass, + OUT PVOID MemoryInformation, + IN SIZE_T MemoryInformationLength, + OUT PSIZE_T ReturnLength) +{ + NTSTATUS Status = STATUS_SUCCESS; + KPROCESSOR_MODE PreviousMode; + + DPRINT("Querying class %d about address: %p\n", MemoryInformationClass, BaseAddress); + + /* Bail out if the address is invalid */ + if (BaseAddress > MM_HIGHEST_USER_ADDRESS) return STATUS_INVALID_PARAMETER; + + /* Probe return buffer */ + PreviousMode = ExGetPreviousMode(); + if (PreviousMode != KernelMode) + { + _SEH2_TRY + { + ProbeForWrite(MemoryInformation, + MemoryInformationLength, + sizeof(ULONG_PTR)); + + if (ReturnLength) ProbeForWriteSize_t(ReturnLength); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + if (!NT_SUCCESS(Status)) + { + return Status; + } + } + + switch(MemoryInformationClass) + { + case MemoryBasicInformation: + /* Validate the size information of the class */ + if (MemoryInformationLength < sizeof(MEMORY_BASIC_INFORMATION)) + { + /* The size is invalid */ + return STATUS_INFO_LENGTH_MISMATCH; + } + Status = MiQueryMemoryBasicInformation(ProcessHandle, + BaseAddress, + MemoryInformation, + MemoryInformationLength, + ReturnLength); + break; + + case MemorySectionName: + /* Validate the size information of the class */ + if (MemoryInformationLength < sizeof(MEMORY_SECTION_NAME)) + { + /* The size is invalid */ + return STATUS_INFO_LENGTH_MISMATCH; + } + Status = MiQueryMemorySectionName(ProcessHandle, + BaseAddress, + MemoryInformation, + MemoryInformationLength, + ReturnLength); + break; + case MemoryWorkingSetList: + case MemoryBasicVlmInformation: + default: + DPRINT1("Unhandled memory information class %d\n", MemoryInformationClass); + break; + } + + return Status; } /* EOF */