for (i = ID_START; i <= ID_RESTART; i++)
{
EnableMenuItem(hMainMenu, i, MF_GRAYED);
- EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_GRAYED);
+ EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), i, MF_GRAYED);
SendMessage(Info->hTool, TB_SETSTATE, i,
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
}
ret = DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_DLG_CREATE),
Info->hMainWnd,
- (DLGPROC)CreateDialogProc,
+ CreateDialogProc,
(LPARAM)Info);
if (ret == IDOK)
RefreshServiceList(Info);
DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_DLG_DELETE),
Info->hMainWnd,
- (DLGPROC)DeleteDialogProc,
+ DeleteDialogProc,
(LPARAM)Info);
}
else
DialogBox(hInstance,
MAKEINTRESOURCE(IDD_ABOUTBOX),
Info->hMainWnd,
- (DLGPROC)AboutDialogProc);
+ AboutDialogProc);
SetFocus(Info->hListView);
break;
<library>freeldr_main</library>
<library>rossym</library>
<library>cmlib</library>
- <library>rtl</library>
+ <library>rtl_kmode</library>
<library>libcntpr</library>
<linkerflag>-static</linkerflag>
<linkerflag>-lgcc</linkerflag>
<library>ppcmmu</library>
</module>
</if>
+ <if property="ARCH" value="amd64">
+ <module name="freeldr" type="bootloader">
+ <bootstrap installbase="loader" />
+ <library>freeldr_startup</library>
+ <library>freeldr_base64k</library>
+ <library>freeldr_base</library>
+ <library>freeldr_arch</library>
+ <library>freeldr_main</library>
+ <library>rossym</library>
+ <library>cmlib</library>
+ <library>rtl</library>
+ <library>libcntpr</library>
+ <linkerflag>-static</linkerflag>
+ <linkerflag>-lgcc</linkerflag>
+ </module>
+ </if>
</group>
<linkerflag>-enable-stdcall-fixup</linkerflag>
<library>ntdll</library>
<library>kernel32</library>
- <library>msvcrt</library>
<library>user32</library>
<define name="USE_EXTERNAL_DXTN_LIB" />
<!-- The following is autogenrated by Makefile.ReactOS -->
<file>prog_parameter.c</file>
<file>prog_print.c</file>
<file>prog_statevars.c</file>
+ <file>prog_uniform.c</file>
<file>program.c</file>
<file>programopt.c</file>
<directory name="grammar">
<file>x86-64.c</file>
</directory>
</directory>
- </module>
+ </module>
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="ncpa" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_NCPA}" installbase="system32" installname="ncpa.cpl" unicode="yes">
- <importlibrary definition="ncpa.def" />
+ <importlibrary definition="ncpa.spec.def" />
<include base="ncpa">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
- <library>wine</library>
<library>kernel32</library>
<library>advapi32</library>
- <library>user32</library>
- <library>comctl32</library>
- <library>iphlpapi</library>
- <library>ws2_32</library>
- <library>dhcpcsvc</library>
+ <library>shell32</library>
<file>ncpa.c</file>
- <file>tcpip_properties.c</file>
- <file>ncpa.rc</file>
+ <file>ncpa.spec</file>
</module>
{
DWORD ErrorCode;
- if (InterlockedCompareExchangePointer(&NtMarta,
+ if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
NULL,
NULL) == NULL)
{
if (ErrorCode == ERROR_SUCCESS)
{
/* try change the NtMarta pointer */
- if (InterlockedCompareExchangePointer(&NtMarta,
+ if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
&NtMartaStatic,
NULL) != NULL)
{
VOID
UnloadNtMarta(VOID)
{
- if (InterlockedExchangePointer(&NtMarta,
+ if (InterlockedExchangePointer((PVOID)&NtMarta,
NULL) != NULL)
{
FreeLibrary(NtMartaStatic.hDllInstance);
TRACE("GetFileSecurityW() called\n");
- if (RequestedInformation &
- (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION))
- {
- AccessMask |= READ_CONTROL;
- }
-
- if (RequestedInformation & SACL_SECURITY_INFORMATION)
- {
- AccessMask |= ACCESS_SYSTEM_SECURITY;
- }
+ QuerySecurityAccessMask(RequestedInformation, &AccessMask);
if (!RtlDosPathNameToNtPathName_U(lpFileName,
&FileName,
TRACE("SetFileSecurityW() called\n");
- if (SecurityInformation &
- (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION))
- {
- AccessMask |= WRITE_OWNER;
- }
-
- if (SecurityInformation & DACL_SECURITY_INFORMATION)
- {
- AccessMask |= WRITE_DAC;
- }
-
- if (SecurityInformation & SACL_SECURITY_INFORMATION)
- {
- AccessMask |= ACCESS_SYSTEM_SECURITY;
- }
+ SetSecurityAccessMask(SecurityInformation, &AccessMask);
if (!RtlDosPathNameToNtPathName_U(lpFileName,
&FileName,
*/
DWORD
STDCALL
-gdiPlaySpoolStream(
+GdiPlaySpoolStream(
DWORD a0,
DWORD a1,
DWORD a2,
return NtGdiGetTextExtentExW(hdc,lpwsz,cwc,dxMax,pcCh,pdxOut,psize,0);
}
- /*
- * @implemented
- */
- INT
- STDCALL
- GetTextFaceAliasW(HDC hdc,
- int cChar,
- LPWSTR pszOut)
- {
- INT retValue = 0;
- if ((!pszOut) || (cChar))
- {
- retValue = NtGdiGetTextFaceW(hdc,cChar,pszOut,TRUE);
- }
- else
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- }
- return retValue;
- }
-
/*
* @unimplemented
*/
LTEXT "IP-Adresse:", -1, 5, 15, 70, 12
LTEXT "Subnetzmaske:", -1, 5, 30, 70, 12
CONTROL "",IDC_SUBNETMASK,"SysIPAddress32", WS_TABSTOP, 100, 30, 80, 12
- PUSHBUTTON "", IDOK, 50, 50, 50, 14, WS_TABSTOP
+ PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP
END
CHECKBOX "Automatische Metrik", IDC_USEMETRIC, 15, 30, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP
LTEXT "&Metric:", IDC_METRICTXT, 5, 45, 45, 12, WS_DISABLED
EDITTEXT IDC_METRIC, 100, 45, 50, 12, WS_TABSTOP | ES_NUMBER | WS_DISABLED
- PUSHBUTTON "", IDOK, 50, 60, 50, 14, WS_TABSTOP
+ PUSHBUTTON "", IDC_OK, 50, 60, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 110, 60, 50, 14, WS_TABSTOP
END
BEGIN
CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 5, 25, 80, 12
LTEXT "DNS-Server:", -1, 5, 10, 120, 12
- PUSHBUTTON "", IDOK, 50, 50, 50, 14, WS_TABSTOP
+ PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP
END
BEGIN
EDITTEXT IDC_SUFFIX, 5, 25, 190, 12, WS_TABSTOP
LTEXT "Domänensuffix:", -1, 5, 10, 120, 12
- PUSHBUTTON "", IDOK, 50, 50, 50, 14, WS_TABSTOP
+ PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP
END
CONTROL "", IDC_IP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 211, 62, 72, 75
PUSHBUTTON "Hinzufügen...", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP
PUSHBUTTON "Entfernen", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP
- PUSHBUTTON "OK", IDOK, 150, 190, 50, 14, WS_TABSTOP
+ PUSHBUTTON "OK", IDC_OK, 150, 190, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP
END
BEGIN
EDITTEXT IDC_PORT_VAL, 5, 30, 70, 12, WS_TABSTOP | ES_NUMBER
LTEXT "", IDC_PORT_DESC, 5, 15, 40, 12
- PUSHBUTTON "OK", IDOK, 120, 15, 50, 14, WS_TABSTOP
+ PUSHBUTTON "OK", IDC_OK, 120, 15, 50, 14, WS_TABSTOP
PUSHBUTTON "Abbrechen", IDCANCEL, 120, 30, 50, 14, WS_TABSTOP
END
IDS_DUP_IPADDR "Die IP-Adresse ist bereits in der Liste vorhanden."
IDS_DUP_GW "Der Standardgateway ist bereits in der Liste vorhanden."
END
- >>>>>>> .merge-right.r36700\r
++>>>>>>> .merge-right.r36700
static __inline PVOID
DesktopPtrToUser(PVOID Ptr)
{
- PW32THREADINFO ti = GetW32ThreadInfo();
+ GetW32ThreadInfo();
+ PCLIENTINFO pci = GetWin32ClientInfo();
+ PDESKTOPINFO pdi = pci->pDeskInfo;
+
ASSERT(Ptr != NULL);
- ASSERT(ti != NULL);
- if ((ULONG_PTR)Ptr >= (ULONG_PTR)ti->DesktopHeapBase &&
- (ULONG_PTR)Ptr < (ULONG_PTR)ti->DesktopHeapBase + ti->DesktopHeapLimit)
+ ASSERT(pdi != NULL);
+ if ((ULONG_PTR)Ptr >= (ULONG_PTR)pdi->pvDesktopBase &&
+ (ULONG_PTR)Ptr < (ULONG_PTR)pdi->pvDesktopLimit)
{
- return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta);
+ return (PVOID)((ULONG_PTR)Ptr - pci->ulClientDelta);
}
else
{
/* NOTE: This is slow as it requires a call to win32k. This should only be
neccessary if a thread wants to access an object on a different
desktop */
- return NtUserGetDesktopMapping(Ptr);
+ return (PVOID)NtUserGetDesktopMapping(Ptr);
}
}
return ti->Hooks != 0;
}
- static __inline PDESKTOP
+ static __inline PDESKTOPINFO
GetThreadDesktopInfo(VOID)
{
PW32THREADINFO ti;
- PDESKTOP di = NULL;
+ PDESKTOPINFO di = NULL;
ti = GetW32ThreadInfo();
if (ti != NULL)
RtlZeroMemory(Descriptor, sizeof(RECEIVE_DESCRIPTOR));
Descriptor->RBADR =
- (ULONG)(Adapter->ReceiveBufferPtrPhys + Adapter->CurrentReceiveDescriptorIndex * BUFFER_SIZE);
+ (ULONG_PTR)(Adapter->ReceiveBufferPtrPhys + Adapter->CurrentReceiveDescriptorIndex * BUFFER_SIZE);
Descriptor->BCNT = (-BUFFER_SIZE) | 0xf000;
Descriptor->FLAGS |= RD_OWN;
return NDIS_STATUS_RESOURCES;
}
- if(((ULONG)Adapter->InitializationBlockVirt & 0x00000003) != 0)
+ if(((ULONG_PTR)Adapter->InitializationBlockVirt & 0x00000003) != 0)
{
DPRINT("address 0x%x not dword-aligned\n", Adapter->InitializationBlockVirt);
BREAKPOINT;
return NDIS_STATUS_RESOURCES;
}
- Adapter->InitializationBlockPhys = (PINITIALIZATION_BLOCK)NdisGetPhysicalAddressLow(PhysicalAddress);
+ Adapter->InitializationBlockPhys = (PINITIALIZATION_BLOCK)(ptrdiff_t)NdisGetPhysicalAddressLow(PhysicalAddress);
/* allocate the transport descriptor ring */
Adapter->TransmitDescriptorRingLength = sizeof(TRANSMIT_DESCRIPTOR) * NUMBER_OF_BUFFERS;
return NDIS_STATUS_RESOURCES;
}
- if(((ULONG)Adapter->TransmitDescriptorRingVirt & 0x00000003) != 0)
+ if(((ULONG_PTR)Adapter->TransmitDescriptorRingVirt & 0x00000003) != 0)
{
DPRINT("address 0x%x not dword-aligned\n", Adapter->TransmitDescriptorRingVirt);
BREAKPOINT;
return NDIS_STATUS_RESOURCES;
}
- Adapter->TransmitDescriptorRingPhys = (PTRANSMIT_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress);
+ Adapter->TransmitDescriptorRingPhys = (PTRANSMIT_DESCRIPTOR)(ptrdiff_t)NdisGetPhysicalAddressLow(PhysicalAddress);
RtlZeroMemory(Adapter->TransmitDescriptorRingVirt, sizeof(TRANSMIT_DESCRIPTOR) * NUMBER_OF_BUFFERS);
/* allocate the receive descriptor ring */
return NDIS_STATUS_RESOURCES;
}
- if(((ULONG)Adapter->ReceiveDescriptorRingVirt & 0x00000003) != 0)
+ if(((ULONG_PTR)Adapter->ReceiveDescriptorRingVirt & 0x00000003) != 0)
{
DPRINT("address 0x%x not dword-aligned\n", Adapter->ReceiveDescriptorRingVirt);
BREAKPOINT;
return NDIS_STATUS_RESOURCES;
}
- Adapter->ReceiveDescriptorRingPhys = (PRECEIVE_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress);
+ Adapter->ReceiveDescriptorRingPhys = (PRECEIVE_DESCRIPTOR)(ptrdiff_t)NdisGetPhysicalAddressLow(PhysicalAddress);
RtlZeroMemory(Adapter->ReceiveDescriptorRingVirt, sizeof(RECEIVE_DESCRIPTOR) * NUMBER_OF_BUFFERS);
/* allocate transmit buffers */
return NDIS_STATUS_RESOURCES;
}
- if(((ULONG)Adapter->TransmitBufferPtrVirt & 0x00000003) != 0)
+ if(((ULONG_PTR)Adapter->TransmitBufferPtrVirt & 0x00000003) != 0)
{
DPRINT("address 0x%x not dword-aligned\n", Adapter->TransmitBufferPtrVirt);
BREAKPOINT;
return NDIS_STATUS_RESOURCES;
}
- Adapter->TransmitBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress);
+ Adapter->TransmitBufferPtrPhys = (PCHAR)(ULONG_PTR)NdisGetPhysicalAddressLow(PhysicalAddress);
RtlZeroMemory(Adapter->TransmitBufferPtrVirt, BUFFER_SIZE * NUMBER_OF_BUFFERS);
/* allocate receive buffers */
return NDIS_STATUS_RESOURCES;
}
- if(((ULONG)Adapter->ReceiveBufferPtrVirt & 0x00000003) != 0)
+ if(((ULONG_PTR)Adapter->ReceiveBufferPtrVirt & 0x00000003) != 0)
{
DPRINT("address 0x%x not dword-aligned\n", Adapter->ReceiveBufferPtrVirt);
BREAKPOINT;
return NDIS_STATUS_RESOURCES;
}
- Adapter->ReceiveBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress);
+ Adapter->ReceiveBufferPtrPhys = (PCHAR)(ULONG_PTR)NdisGetPhysicalAddressLow(PhysicalAddress);
RtlZeroMemory(Adapter->ReceiveBufferPtrVirt, BUFFER_SIZE * NUMBER_OF_BUFFERS);
/* initialize tx descriptors */
TransmitDescriptor = Adapter->TransmitDescriptorRingVirt;
for(i = 0; i < NUMBER_OF_BUFFERS; i++)
{
- (TransmitDescriptor+i)->TBADR = (ULONG)Adapter->TransmitBufferPtrPhys + i * BUFFER_SIZE;
+ (TransmitDescriptor+i)->TBADR = (ULONG_PTR)Adapter->TransmitBufferPtrPhys + i * BUFFER_SIZE;
(TransmitDescriptor+i)->BCNT = 0xf000 | -BUFFER_SIZE; /* 2's compliment + set top 4 bits */
(TransmitDescriptor+i)->FLAGS = TD1_STP | TD1_ENP;
}
ReceiveDescriptor = Adapter->ReceiveDescriptorRingVirt;
for(i = 0; i < NUMBER_OF_BUFFERS; i++)
{
- (ReceiveDescriptor+i)->RBADR = (ULONG)Adapter->ReceiveBufferPtrPhys + i * BUFFER_SIZE;
+ (ReceiveDescriptor+i)->RBADR = (ULONG_PTR)Adapter->ReceiveBufferPtrPhys + i * BUFFER_SIZE;
(ReceiveDescriptor+i)->BCNT = 0xf000 | -BUFFER_SIZE; /* 2's compliment + set top 4 bits */
(ReceiveDescriptor+i)->FLAGS = RD_OWN;
}
/* set up receive ring */
DPRINT("Receive ring physical address: 0x%x\n", Adapter->ReceiveDescriptorRingPhys);
- Adapter->InitializationBlockVirt->RDRA = (ULONG)Adapter->ReceiveDescriptorRingPhys;
+ Adapter->InitializationBlockVirt->RDRA = (ULONG_PTR)Adapter->ReceiveDescriptorRingPhys;
Adapter->InitializationBlockVirt->RLEN = (LOG_NUMBER_OF_BUFFERS << 4) & 0xf0;
/* set up transmit ring */
DPRINT("Transmit ring physical address: 0x%x\n", Adapter->TransmitDescriptorRingPhys);
- Adapter->InitializationBlockVirt->TDRA = (ULONG)Adapter->TransmitDescriptorRingPhys;
+ Adapter->InitializationBlockVirt->TDRA = (ULONG_PTR)Adapter->TransmitDescriptorRingPhys;
Adapter->InitializationBlockVirt->TLEN = (LOG_NUMBER_OF_BUFFERS << 4) & 0xf0;
}
if(Adapter->InitializationBlockVirt)
{
- PhysicalAddress.u.LowPart = (ULONG)Adapter->InitializationBlockPhys;
+ PhysicalAddress.u.LowPart = (ULONG_PTR)Adapter->InitializationBlockPhys;
NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->InitializationBlockLength,
FALSE, Adapter->InitializationBlockVirt, PhysicalAddress);
}
if(Adapter->TransmitDescriptorRingVirt)
{
- PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitDescriptorRingPhys;
+ PhysicalAddress.u.LowPart = (ULONG_PTR)Adapter->TransmitDescriptorRingPhys;
NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitDescriptorRingLength,
FALSE, Adapter->TransmitDescriptorRingVirt, PhysicalAddress);
}
if(Adapter->ReceiveDescriptorRingVirt)
{
- PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveDescriptorRingPhys;
+ PhysicalAddress.u.LowPart = (ULONG_PTR)Adapter->ReceiveDescriptorRingPhys;
NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveDescriptorRingLength,
FALSE, Adapter->ReceiveDescriptorRingVirt, PhysicalAddress);
}
if(Adapter->TransmitBufferPtrVirt)
{
- PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitBufferPtrPhys;
+ PhysicalAddress.u.LowPart = (ULONG_PTR)Adapter->TransmitBufferPtrPhys;
NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitBufferLength,
FALSE, Adapter->TransmitBufferPtrVirt, PhysicalAddress);
}
if(Adapter->ReceiveBufferPtrVirt)
{
- PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveBufferPtrPhys;
+ PhysicalAddress.u.LowPart = (ULONG_PTR)Adapter->ReceiveBufferPtrPhys;
NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveBufferLength,
FALSE, Adapter->ReceiveBufferPtrVirt, PhysicalAddress);
}
/* deregister i/o port range */
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, (PVOID)Adapter->PortOffset);
+ /* deregister the shutdown routine */
+ NdisMDeregisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle);
+
/* free shared memory */
MiFreeSharedMemory(Adapter);
/* set up csr1 and csr2 with init block */
NdisRawWritePortUshort(Adapter->PortOffset + RAP, CSR1);
- NdisRawWritePortUshort(Adapter->PortOffset + RDP, (USHORT)((ULONG)Adapter->InitializationBlockPhys & 0xffff));
+ NdisRawWritePortUshort(Adapter->PortOffset + RDP, (USHORT)((ULONG_PTR)Adapter->InitializationBlockPhys & 0xffff));
NdisRawWritePortUshort(Adapter->PortOffset + RAP, CSR2);
- NdisRawWritePortUshort(Adapter->PortOffset + RDP, (USHORT)((ULONG)Adapter->InitializationBlockPhys >> 16) & 0xffff);
+ NdisRawWritePortUshort(Adapter->PortOffset + RDP, (USHORT)((ULONG_PTR)Adapter->InitializationBlockPhys >> 16) & 0xffff);
DPRINT("programmed with init block\n");
}
#endif
+ VOID
+ STDCALL
+ MiniportShutdown( PVOID Context )
+ {
+ PADAPTER Adapter = Context;
+
+ DPRINT("Stopping the chip\n");
+
+ NdisRawWritePortUshort(Adapter->PortOffset + RAP, CSR0);
+ NdisRawWritePortUshort(Adapter->PortOffset + RDP, CSR0_STOP);
+ }
+
static NDIS_STATUS
STDCALL
MiniportInitialize(
ASSERT(0);
#endif
+ NdisMRegisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle, Adapter, MiniportShutdown);
+
DPRINT("returning 0x%x\n", Status);
*OpenErrorStatus = Status;
return Status;
struct {
ULONG Level;
ULONG Vector;
- ULONG Affinity;
+ KAFFINITY Affinity;
} Interrupt;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ struct {
+ union {
+ struct {
+ USHORT Reserved;
+ USHORT MessageCount;
+ ULONG Vector;
+ KAFFINITY Affinity;
+ } Raw;
+ struct {
+ ULONG Level;
+ ULONG Vector;
+ KAFFINITY Affinity;
+ } Translated;
+ };
+ } MessageInterrupt;
+#endif
struct {
PHYSICAL_ADDRESS Start;
ULONG Length;
ULONG Reserved1;
ULONG Reserved2;
} DeviceSpecificData;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length40;
+ } Memory40;
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length48;
+ } Memory48;
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length64;
+ } Memory64;
+#endif
} u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
ULONG HalReserved[16]; // For use by Hal
} KPCR, *PKPCR; /* 54 */
+#define KeGetPcr() PCR
+
typedef struct _KFLOATING_SAVE {
ULONG ControlWord;
ULONG StatusWord;
UCHAR Number; /* 51 */
} KPCR, *PKPCR; /* 54 */
+#define KeGetPcr() PCR
+
static __inline
ULONG
DDKAPI
ULONG IDR; /* 30 */
} KPCR, *PKPCR;
+#define KeGetPcr() PCR
+
typedef struct _KFLOATING_SAVE {
} KFLOATING_SAVE, *PKFLOATING_SAVE;
} PCIBUSDATA, *PPCIBUSDATA;
+/** INTERLOCKED FUNCTIONS *****************************************************/
#if !defined(__INTERLOCKED_DECLARED)
#define __INTERLOCKED_DECLARED
#define InterlockedPushEntrySList(Head, Entry) ExpInterlockedPushEntrySList(Head, Entry)
#define InterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
#define QueryDepthSList(Head) ExQueryDepthSList(Head)
-#endif // !defined(_WINBASE_
+#endif // !defined(_WINBASE_)
#endif // _M_AMD64
#endif /* !__INTERLOCKED_DECLARED */
+
+/** SPINLOCK FUNCTIONS ********************************************************/
+
NTKERNELAPI
-VOID
+BOOLEAN
FASTCALL
-KefAcquireSpinLockAtDpcLevel(
- IN PKSPIN_LOCK SpinLock);
+KeTryToAcquireSpinLockAtDpcLevel(
+ IN OUT PKSPIN_LOCK SpinLock
+);
+
+#if defined (_X86_)
NTKERNELAPI
VOID
-FASTCALL
-KefReleaseSpinLockFromDpcLevel(
+NTAPI
+KeInitializeSpinLock(
IN PKSPIN_LOCK SpinLock);
-#if defined(_M_AMD64)
-NTKERNELAPI
+NTHALAPI
KIRQL
FASTCALL
KfAcquireSpinLock(
IN PKSPIN_LOCK SpinLock);
-NTKERNELAPI
+NTHALAPI
VOID
FASTCALL
KfReleaseSpinLock(
IN PKSPIN_LOCK SpinLock,
IN KIRQL NewIrql);
-#else
-NTHALAPI
-KIRQL
-FASTCALL
-KfAcquireSpinLock(
- IN PKSPIN_LOCK SpinLock);
-NTHALAPI
+NTKERNELAPI
VOID
FASTCALL
-KfReleaseSpinLock(
- IN PKSPIN_LOCK SpinLock,
- IN KIRQL NewIrql);
-#endif
+KefAcquireSpinLockAtDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
NTKERNELAPI
-BOOLEAN
+VOID
FASTCALL
-KeTryToAcquireSpinLockAtDpcLevel(
- IN OUT PKSPIN_LOCK SpinLock
-);
+KefReleaseSpinLockFromDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
+#else // !defined (_X86_)
+
+FORCEINLINE
+VOID
+NTAPI
+KeInitializeSpinLock(
+ PKSPIN_LOCK SpinLock)
+{
+ *SpinLock = 0;
+}
+
+NTKERNELAPI
+VOID
+KeReleaseSpinLock(
+ IN PKSPIN_LOCK SpinLock,
+ IN KIRQL NewIrql);
+
+NTKERNELAPI
+VOID
+KeAcquireSpinLockAtDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
+
+NTKERNELAPI
+VOID
+KeReleaseSpinLockFromDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
+
+NTKERNELAPI
+KIRQL
+KeAcquireSpinLockRaiseToDpc(
+ IN PKSPIN_LOCK SpinLock);
+
+#define KeAcquireSpinLock(SpinLock, OldIrql) \
+ *(OldIrql) = KeAcquireSpinLockRaiseToDpc(SpinLock)
+
+#endif // !defined (_X86_)
+
#define RtlCopyMemoryNonTemporal RtlCopyMemory
#define KeGetDcacheFillSize() 1L
return Result;
}
+static __inline
+LARGE_INTEGER
+NTAPI_INLINE
+RtlConvertUlongToLargeInteger(
+ ULONG UnsignedInteger)
+{
+ LARGE_INTEGER ret;
+ ret.QuadPart = UnsignedInteger;
+ return ret;
+}
+
NTSYSAPI
LUID
NTAPI
RtlConvertLongToLuid(
IN LONG Long);
-NTSYSAPI
-LARGE_INTEGER
-NTAPI
-RtlConvertUlongToLargeInteger(
- IN ULONG UnsignedInteger);
NTSYSAPI
LUID
RtlConvertUlongToLuid(
ULONG Ulong);
+#ifdef _M_AMD64
+
+static __inline
+LARGE_INTEGER
+NTAPI_INLINE
+RtlExtendedIntegerMultiply(
+ LARGE_INTEGER Multiplicand,
+ LONG Multiplier)
+{
+ LARGE_INTEGER ret;
+ ret.QuadPart = Multiplicand.QuadPart * Multiplier;
+ return ret;
+}
+
+static __inline
+LARGE_INTEGER
+NTAPI_INLINE
+RtlExtendedLargeIntegerDivide(
+ LARGE_INTEGER Dividend,
+ ULONG Divisor,
+ PULONG Remainder)
+{
+ LARGE_INTEGER ret;
+ ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
+ if (Remainder)
+ *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
+ return ret;
+}
+
+#endif
+
/*
* VOID
* RtlCopyMemory(
NTAPI
ProbeForRead(
IN CONST VOID *Address,
- IN ULONG Length,
+ IN SIZE_T Length,
IN ULONG Alignment);
NTKERNELAPI
NTAPI
ProbeForWrite(
IN PVOID Address,
- IN ULONG Length,
+ IN SIZE_T Length,
IN ULONG Alignment);
IN LONG Count,
IN LONG Limit);
-NTKERNELAPI
-VOID
-NTAPI
-KeInitializeSpinLock(
- IN PKSPIN_LOCK SpinLock);
-
NTKERNELAPI
VOID
NTAPI
IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
- IN ULONG ZeroBits,
- IN ULONG CommitSize,
+ IN ULONG_PTR ZeroBits,
+ IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
- IN ULONG ZeroBits,
- IN ULONG CommitSize,
+ IN ULONG_PTR ZeroBits,
+ IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
HANDLE Handle;
} USER_OBJHDR, PUSER_OBJHDR;
- typedef struct _DESKTOP
+ typedef struct _DESKTOPINFO
{
+ PVOID pvDesktopBase;
+ PVOID pvDesktopLimit;
+
HANDLE hKernelHeap;
ULONG_PTR HeapLimit;
HWND hTaskManWindow;
};
WCHAR szDesktopName[1];
- } DESKTOP, *PDESKTOP;
+ } DESKTOPINFO, *PDESKTOPINFO;
typedef struct _CALLPROC
{
struct _WINDOWCLASS *Next;
struct _WINDOWCLASS *Clone;
struct _WINDOWCLASS *Base;
- PDESKTOP Desktop;
+ struct _DESKTOP *rpdeskParent;
RTL_ATOM Atom;
ULONG Windows;
is moved to this structure */
struct _W32PROCESSINFO *pi; /* FIXME: Move to object header some day */
struct _W32THREADINFO *ti;
+ struct _DESKTOP *pdesktop;
RECT WindowRect;
RECT ClientRect;
typedef struct _CLIENTTHREADINFO
{
DWORD CTI_flags;
+ WORD fsChangeBits;
+ WORD fsWakeBits;
+ WORD fsWakeBitsJournal;
+ WORD fsWakeMask;
+ LONG timeLastRead;
DWORD dwcPumpHook;
} CLIENTTHREADINFO, *PCLIENTTHREADINFO;
{
PW32PROCESSINFO pi; /* [USER] */
PW32PROCESSINFO kpi; /* [KERNEL] */
- PDESKTOP Desktop;
- PVOID DesktopHeapBase;
- ULONG_PTR DesktopHeapLimit;
- ULONG_PTR DesktopHeapDelta;
+ PDESKTOPINFO Desktop;
+ // PVOID DesktopHeapBase;
+ // ULONG_PTR DesktopHeapLimit;
/* A mask of what hooks are currently active */
ULONG Hooks;
- /* Application compatibility flags */
- DWORD AppCompatFlags;
- DWORD AppCompatFlags2;
CLIENTTHREADINFO ClientThreadInfo;
} W32THREADINFO, *PW32THREADINFO;
#define CI_CURTHPRHOOK 0x00000010
- typedef struct _W32CLIENTINFO
+ typedef struct _CLIENTINFO
{
ULONG CI_flags;
ULONG cSpins;
- ULONG ulWindowsVersion;
- ULONG ulAppCompatFlags;
- ULONG ulAppCompatFlags2;
+ DWORD dwExpWinVer;
+ DWORD dwCompatFlags;
+ DWORD dwCompatFlags2;
DWORD dwTIFlags;
- PVOID pDeskInfo;
+ PDESKTOPINFO pDeskInfo;
ULONG_PTR ulClientDelta;
PHOOK phkCurrent;
ULONG fsHooks;
- HWND hWND; // Will be replaced with CALLBACKWND.
- PVOID pvWND; // " "
+ CALLBACKWND CallbackWnd;
ULONG Win32ClientInfo;
DWORD dwHookCurrent;
- ULONG Win32ClientInfo1;
+ INT cInDDEMLCallback;
PCLIENTTHREADINFO pClientThreadInfo;
DWORD dwHookData;
DWORD dwKeyCache;
- ULONG Win32ClientInfo2[7];
+ DWORD afKeyState[2];
+ DWORD dwAsyncKeyCache;
+ DWORD afAsyncKeyState[2];
+ DWORD afAsyncKeyStateRecentDow[2];
+ HKL hKL;
USHORT CodePage;
- USHORT csCF;
- HANDLE hKL;
+ USHORT achDbcsCF;
ULONG Win32ClientInfo3[35];
- } W32CLIENTINFO, *PW32CLIENTINFO;
+ } CLIENTINFO, *PCLIENTINFO;
+
+ /* Make sure it fits exactly into the TEB */
+ C_ASSERT(sizeof(CLIENTINFO) == FIELD_OFFSET(TEB, glDispatchTable) - FIELD_OFFSET(TEB, Win32ClientInfo));
- #define GetWin32ClientInfo() (PW32CLIENTINFO)(NtCurrentTeb()->Win32ClientInfo)
+ #define GetWin32ClientInfo() ((PCLIENTINFO)(NtCurrentTeb()->Win32ClientInfo))
// Server event activity bits.
#define SRV_EVENT_MENU 0x0001
LPARAM lParam,
BOOL Ansi);
-DWORD
+DWORD_PTR
NTAPI
NtUserCallNoParam(
DWORD Routine);
-DWORD
+DWORD_PTR
NTAPI
NtUserCallOneParam(
DWORD Param,
DWORD Routine);
-DWORD
+DWORD_PTR
NTAPI
NtUserCallTwoParam(
DWORD Param1,
THREADSTATE_TASKMANWINDOW
};
-DWORD
+DWORD_PTR
NTAPI
NtUserGetThreadState(
DWORD Routine);
MmGetFileNameForAddress(IN PVOID Address,
OUT PUNICODE_STRING ModuleName)
{
- /*
- * FIXME: TODO.
- * Filip says to get the MM_AVL_TABLE from EPROCESS,
- * then use the MmMarea routines to locate the Marea that
- * corresponds to the address. Then make sure it's a section
- * view type (MEMORY_AREA_SECTION_VIEW) and use the marea's
- * per-type union to get the .u.SectionView.Section pointer to
- * the SECTION_OBJECT. Then we can use MmGetFileNameForSection
- * to get the full filename.
- */
- RtlCreateUnicodeString(ModuleName, L"C:\\ReactOS\\system32\\ntdll.dll");
- return STATUS_SUCCESS;
+ PROS_SECTION_OBJECT Section;
+ PMEMORY_AREA MemoryArea;
+ PMM_AVL_TABLE AddressSpace;
+ POBJECT_NAME_INFORMATION ModuleNameInformation;
+ NTSTATUS Status = STATUS_ADDRESS_NOT_ASSOCIATED;
+
+ /* Get the MM_AVL_TABLE from EPROCESS */
+ if (Address >= MmSystemRangeStart)
+ {
+ AddressSpace = MmGetKernelAddressSpace();
+ }
+ else
+ {
+ AddressSpace = &PsGetCurrentProcess()->VadRoot;
+ }
+
+ /* Lock address space */
+ MmLockAddressSpace(AddressSpace);
+
+ /* Locate the memory area for the process by address */
+ MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
+
+ /* Make sure it's a section view type */
+ if ((MemoryArea != NULL) && (MemoryArea->Type == MEMORY_AREA_SECTION_VIEW))
+ {
+ /* Get the section pointer to the SECTION_OBJECT */
+ Section = MemoryArea->Data.SectionData.Section;
+
+ /* Unlock address space */
+ MmUnlockAddressSpace(AddressSpace);
+
+ /* Get the filename of the section */
+ Status = MmGetFileNameForSection(Section,&ModuleNameInformation);
+
+ if (NT_SUCCESS(Status))
+ {
+ /* Init modulename */
+ RtlCreateUnicodeString(ModuleName,
+ ModuleNameInformation->Name.Buffer);
+
+ /* Free temp taged buffer from MmGetFileNameForSection() */
+ ExFreePoolWithTag(ModuleNameInformation, TAG('M', 'm', ' ', ' '));
+ DPRINT("Found ModuleName %S by address %p\n",
+ ModuleName->Buffer,Address);
+ }
+ }
+ else
+ {
+ /* Unlock address space */
+ MmUnlockAddressSpace(AddressSpace);
+ }
+
+ return Status;
}
/* Note: Mmsp prefix denotes "Memory Manager Section Private". */
MmQuerySectionView(PMEMORY_AREA MemoryArea,
PVOID Address,
PMEMORY_BASIC_INFORMATION Info,
- PULONG ResultLength)
+ PSIZE_T ResultLength)
{
PMM_REGION Region;
PVOID RegionBaseAddress;
LARGE_INTEGER Offset;
CHAR Buffer;
FILE_STANDARD_INFORMATION FileInfo;
+ ULONG Length;
/*
* Create the section
FileStandardInformation,
sizeof(FILE_STANDARD_INFORMATION),
&FileInfo,
- &Iosb.Information);
+ &Length);
+ Iosb.Information = Length;
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
NtQuerySection(IN HANDLE SectionHandle,
IN SECTION_INFORMATION_CLASS SectionInformationClass,
OUT PVOID SectionInformation,
- IN ULONG SectionInformationLength,
- OUT PULONG ResultLength OPTIONAL)
+ IN SIZE_T SectionInformationLength,
+ OUT PSIZE_T ResultLength OPTIONAL)
{
PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode;
NTSTATUS STDCALL
MmMapViewInSystemSpace (IN PVOID SectionObject,
OUT PVOID * MappedBase,
- IN OUT PULONG ViewSize)
+ IN OUT PSIZE_T ViewSize)
{
PROS_SECTION_OBJECT Section;
PMM_AVL_TABLE AddressSpace;
typedef struct _INT_CALLBACK_HEADER
{
- /* list entry in the W32THREAD structure */
+ /* list entry in the THREADINFO structure */
LIST_ENTRY ListEntry;
}
INT_CALLBACK_HEADER, *PINT_CALLBACK_HEADER;
IntCbAllocateMemory(ULONG Size)
{
PINT_CALLBACK_HEADER Mem;
- PW32THREAD W32Thread;
+ PTHREADINFO W32Thread;
if(!(Mem = ExAllocatePoolWithTag(PagedPool, Size + sizeof(INT_CALLBACK_HEADER),
TAG_CALLBACK)))
IntCbFreeMemory(PVOID Data)
{
PINT_CALLBACK_HEADER Mem;
- PW32THREAD W32Thread;
+ PTHREADINFO W32Thread;
ASSERT(Data);
}
VOID FASTCALL
- IntCleanupThreadCallbacks(PW32THREAD W32Thread)
+ IntCleanupThreadCallbacks(PTHREADINFO W32Thread)
{
PLIST_ENTRY CurrentEntry;
PINT_CALLBACK_HEADER Mem;
{
HWND hWndS = *hWnd;
PWINDOW_OBJECT Window = UserGetWindowObject(*hWnd);
- PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
+ PCLIENTINFO ClientInfo = GetWin32ClientInfo();
- *hWnd = ClientInfo->hWND;
- *pWnd = ClientInfo->pvWND;
+ *hWnd = ClientInfo->CallbackWnd.hWnd;
+ *pWnd = ClientInfo->CallbackWnd.pvWnd;
- ClientInfo->hWND = hWndS;
- ClientInfo->pvWND = DesktopHeapAddressToUser(Window->Wnd);
+ ClientInfo->CallbackWnd.hWnd = hWndS;
+ ClientInfo->CallbackWnd.pvWnd = DesktopHeapAddressToUser(Window->Wnd);
}
static VOID
IntRestoreTebWndCallback (HWND hWnd, PVOID pWnd)
{
- PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
+ PCLIENTINFO ClientInfo = GetWin32ClientInfo();
- ClientInfo->hWND = hWnd;
- ClientInfo->pvWND = pWnd;
+ ClientInfo->CallbackWnd.hWnd = hWnd;
+ ClientInfo->CallbackWnd.pvWnd = pWnd;
}
/* FUNCTIONS *****************************************************************/
{
RtlCopyMemory(Extra, ClassName->Buffer, ClassName->Length);
CbtCreatewndExtra->Cs.lpszClass =
- (LPCWSTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra, 1);
+ (LPCWSTR)(ULONG_PTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra, 1);
Extra += ClassName->Length;
*((WCHAR *) Extra) = L'\0';
}
IntRestoreTebWndCallback (hWnd, pWnd);
IntCbFreeMemory(Argument);
-
+
if (!NT_SUCCESS(Status))
{
return 0;
}
/* free the structure */
- if (Class->Desktop != NULL)
+ if (Class->rpdeskParent != NULL)
{
- DesktopHeapFree(Class->Desktop,
+ DesktopHeapFree(Class->rpdeskParent,
Class);
}
else
ASSERT(Desktop != NULL);
ASSERT(BaseClass->Base == BaseClass);
- if (BaseClass->Desktop == Desktop)
+ if (BaseClass->rpdeskParent == Desktop)
{
/* it is most likely that a window is created on the same
desktop as the window class. */
return BaseClass;
}
- if (BaseClass->Desktop == NULL)
+ if (BaseClass->rpdeskParent == NULL)
{
ASSERT(BaseClass->Windows == 0);
ASSERT(BaseClass->Clone == NULL);
Class = BaseClass->Clone;
while (Class != NULL)
{
- if (Class->Desktop == Desktop)
+ if (Class->rpdeskParent == Desktop)
{
ASSERT(Class->Base == BaseClass);
ASSERT(Class->Clone == NULL);
ClassSize);
/* update some pointers and link the class */
- Class->Desktop = Desktop;
+ Class->rpdeskParent = Desktop;
Class->Windows = 0;
- if (BaseClass->Desktop == NULL)
+ if (BaseClass->rpdeskParent == NULL)
{
/* we don't really need the base class on the shared
heap anymore, delete it so the only class left is
Class->Clone = NULL;
Class->Base = BaseClass;
Class->Next = BaseClass->Clone;
- (void)InterlockedExchangePointer(&BaseClass->Clone,
+ (void)InterlockedExchangePointer((VOID*)&BaseClass->Clone,
Class);
}
}
ASSERT(Class->Base != Class);
ASSERT(Class->Base->Clone != NULL);
- ASSERT(Class->Desktop != NULL);
+ ASSERT(Class->rpdeskParent != NULL);
ASSERT(Class->Windows != 0);
- ASSERT(Class->Base->Desktop != NULL);
+ ASSERT(Class->Base->rpdeskParent != NULL);
ASSERT(Class->Base->Windows == 0);
/* unlink the clone */
VOID
IntDereferenceClass(IN OUT PWINDOWCLASS Class,
- IN PDESKTOP Desktop,
+ IN PDESKTOPINFO Desktop,
IN PW32PROCESSINFO pi)
{
PWINDOWCLASS *PrevLink, BaseClass, CurrentClass;
SIZE_T ClassSize;
ASSERT(Class->Base == Class);
- ASSERT(Class->Desktop != NULL);
+ ASSERT(Class->rpdeskParent != NULL);
ASSERT(Class->Windows == 0);
ASSERT(Class->Clone == NULL);
Class,
ClassSize);
- NewClass->Desktop = NULL;
+ NewClass->rpdeskParent = NULL;
NewClass->Base = NewClass;
/* replace the class in the list */
ASSERT(Class->Base == Class);
- if (Class->Desktop == Desktop &&
+ if (Class->rpdeskParent == Desktop &&
Class->Windows == 0)
{
/* there shouldn't be any clones around anymore! */
RtlZeroMemory(Class,
ClassSize);
- Class->Desktop = Desktop;
+ Class->rpdeskParent = Desktop;
Class->Base = Class;
Class->Atom = Atom;
IN WNDPROC wpExtra,
IN DWORD dwFlags)
{
+ PTHREADINFO pti;
PW32THREADINFO ti;
PW32PROCESSINFO pi;
PWINDOWCLASS Class;
/* NOTE: Accessing the buffers in ClassName and MenuName may raise exceptions! */
+ pti = PsGetCurrentThreadWin32Thread();
ti = GetW32ThreadInfo();
if (ti == NULL || !ti->kpi->RegisteredSysClasses)
{
MenuName,
wpExtra,
dwFlags,
- ti->Desktop,
+ pti->Desktop,
pi);
if (Class != NULL)
static PHOOK
IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinStaObj)
{
- PW32THREAD W32Thread;
+ PTHREADINFO W32Thread;
PHOOK Hook;
- PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue);
+ PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PTHREADINFO)Thread->Tcb.Win32Thread)->MessageQueue);
HANDLE Handle;
if (NULL == Table)
}
else
{
- MsqSetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue, Table);
+ MsqSetHooks(((PTHREADINFO)Thread->Tcb.Win32Thread)->MessageQueue, Table);
}
}
if (Thread)
{
- W32Thread = ((PW32THREAD)Thread->Tcb.Win32Thread);
+ W32Thread = ((PTHREADINFO)Thread->Tcb.Win32Thread);
ASSERT(W32Thread != NULL);
W32Thread->Hooks |= HOOKID_TO_FLAG(HookId);
if (W32Thread->ThreadInfo != NULL)
return GlobalHooks;
}
- return MsqGetHooks(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue);
+ return MsqGetHooks(((PTHREADINFO)Hook->Thread->Tcb.Win32Thread)->MessageQueue);
}
/* get the first hook in the chain */
static VOID
IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked)
{
- PW32THREAD W32Thread;
+ PTHREADINFO W32Thread;
PHOOKTABLE Table = IntGetTable(Hook);
ASSERT(NULL != Table);
return;
}
- W32Thread = ((PW32THREAD)Hook->Thread->Tcb.Win32Thread);
+ W32Thread = ((PTHREADINFO)Hook->Thread->Tcb.Win32Thread);
ASSERT(W32Thread != NULL);
W32Thread->Hooks &= ~HOOKID_TO_FLAG(Hook->HookId);
if (W32Thread->ThreadInfo != NULL)
/* FIXME should get timeout from
* HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout */
- Status = co_MsqSendMessage(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue,
+ Status = co_MsqSendMessage(((PTHREADINFO)Hook->Thread->Tcb.Win32Thread)->MessageQueue,
- (HWND) Code,
+ (HWND)(UINT_PTR)Code,
Hook->HookId,
wParam,
lParam,
co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
{
PHOOK Hook, SaveHook;
- PW32THREAD Win32Thread;
- PW32CLIENTINFO ClientInfo;
+ PTHREADINFO pti;
+ PCLIENTINFO ClientInfo;
PHOOKTABLE Table;
LRESULT Result;
PWINSTATION_OBJECT WinStaObj;
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
- Win32Thread = PsGetCurrentThreadWin32Thread();
- if (NULL == Win32Thread)
+ pti = PsGetCurrentThreadWin32Thread();
+ if (!pti)
{
Table = NULL;
}
else
{
- Table = MsqGetHooks(Win32Thread->MessageQueue);
+ Table = MsqGetHooks(pti->MessageQueue);
}
if (NULL == Table || ! (Hook = IntGetFirstValidHook(Table, HookId)))
}
else
{
- IntReleaseHookChain(MsqGetHooks(PsGetCurrentThreadWin32Thread()->MessageQueue), HookId, WinStaObj);
+ IntReleaseHookChain(MsqGetHooks(pti->MessageQueue), HookId, WinStaObj);
IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
ObDereferenceObject(WinStaObj);
}
BOOL Ansi)
{
PHOOK HookObj, NextObj;
- PW32CLIENTINFO ClientInfo;
+ PCLIENTINFO ClientInfo;
PWINSTATION_OBJECT WinStaObj;
NTSTATUS Status;
DECLARE_RETURN(LRESULT);
HHOOK
STDCALL
NtUserSetWindowsHookAW(
- int idHook,
+ int idHook,
HOOKPROC lpfn,
BOOL Ansi)
{
BOOL Ansi)
{
PWINSTATION_OBJECT WinStaObj;
- PW32CLIENTINFO ClientInfo;
+ PCLIENTINFO ClientInfo;
BOOLEAN Global;
PETHREAD Thread;
PHOOK Hook;
}
Mod = NULL;
Global = FALSE;
- if (! NT_SUCCESS(PsLookupThreadByThreadId((HANDLE) ThreadId, &Thread)))
+ if (! NT_SUCCESS(PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)ThreadId, &Thread)))
{
DPRINT1("Invalid thread id 0x%x\n", ThreadId);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
UserLeave();
END_CLEANUP;
}
-
+
/* EOF */
hKl |= 0xe001 << 16; /* FIXME */\r
else hKl |= hKl << 16;\r
\r
- NewKbl->hkl = (HKL) hKl;\r
+ NewKbl->hkl = (HKL)(ULONG_PTR) hKl;\r
NewKbl->klid = LocaleId;\r
NewKbl->Flags = 0;\r
NewKbl->RefCount = 0;\r
return TRUE;\r
}\r
\r
- static PKBL co_UserActivateKbl(PW32THREAD w32Thread, PKBL pKbl, UINT Flags)\r
+ static PKBL co_UserActivateKbl(PTHREADINFO w32Thread, PKBL pKbl, UINT Flags)\r
{\r
PKBL Prev;\r
\r
{\r
NTSTATUS Status;\r
PETHREAD Thread;\r
- PW32THREAD W32Thread;\r
+ PTHREADINFO W32Thread;\r
HKL Ret;\r
\r
if(!dwThreadId)\r
return W32Thread->KeyboardLayout->hkl;\r
}\r
\r
- Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);\r
+ Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread);\r
if(!NT_SUCCESS(Status))\r
{\r
SetLastWin32Error(ERROR_INVALID_PARAMETER);\r
{\r
BOOL ret = FALSE;\r
PKBL pKbl;\r
+ PTHREADINFO pti;\r
\r
UserEnterShared();\r
\r
_SEH_TRY\r
{\r
ProbeForWrite(lpszName, KL_NAMELENGTH*sizeof(WCHAR), 1);\r
- pKbl = PsGetCurrentThreadWin32Thread()->KeyboardLayout;\r
+ pti = PsGetCurrentThreadWin32Thread();\r
+ pKbl = pti->KeyboardLayout;\r
RtlCopyMemory(lpszName, pKbl->Name, KL_NAMELENGTH*sizeof(WCHAR));\r
ret = TRUE;\r
}\r
{\r
PKBL pKbl;\r
HKL Ret = NULL;\r
- PW32THREAD pWThread;\r
+ PTHREADINFO pWThread;\r
\r
UserEnterExclusive();\r
\r
IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
{
PMENU_OBJECT Menu;
+ PW32PROCESS CurrentWin32Process;
Menu = (PMENU_OBJECT)UserCreateObject(
gHandleTable, Handle,
Menu->MenuItemList = NULL;
/* Insert menu item into process menu handle list */
- InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
+ CurrentWin32Process = PsGetCurrentProcessWin32Process();
+ InsertTailList(&CurrentWin32Process->MenuListHead, &Menu->ListEntry);
return Menu;
}
PMENU_OBJECT FASTCALL
IntCloneMenu(PMENU_OBJECT Source)
{
+ PW32PROCESS CurrentWin32Process;
HANDLE hMenu;
PMENU_OBJECT Menu;
Menu->MenuItemList = NULL;
/* Insert menu item into process menu handle list */
- InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
+ CurrentWin32Process = PsGetCurrentProcessWin32Process();
+ InsertTailList(&CurrentWin32Process->MenuListHead, &Menu->ListEntry);
IntCloneMenuItems(Menu, Source);
RETURN(FALSE);
}
- hMenu = (HMENU)WindowObject->Wnd->IDMenu;
+ hMenu = (HMENU)(DWORD_PTR)WindowObject->Wnd->IDMenu;
if (!(MenuObject = UserGetMenuObject(hMenu)))
{
RETURN(FALSE);
}
- if(Window->Wnd->IDMenu == (UINT)hMenu)
+ if(Window->Wnd->IDMenu == (UINT)(UINT_PTR)hMenu)
{
RETURN( IntHiliteMenuItem(Window, Menu, uItemHilite, uHilite));
}
if bInsert == TRUE call NtUserInsertMenuItem() else NtUserSetMenuItemInfo() */
if (bInsert) return UserInsertMenuItem(hMenu, uItem, fByPosition, lpmii);
-
+
UNIMPLEMENTED
return 0;
}
/*
* @unimplemented
*/
-DWORD STDCALL
+DWORD_PTR STDCALL
NtUserGetThreadState(
DWORD Routine)
{
- DECLARE_RETURN(DWORD);
+ DWORD_PTR ret = 0;
DPRINT("Enter NtUserGetThreadState\n");
if (Routine != THREADSTATE_GETTHREADINFO)
{
case THREADSTATE_GETTHREADINFO:
GetW32ThreadInfo();
- RETURN(0);
-
+ break;
case THREADSTATE_FOCUSWINDOW:
- RETURN( (DWORD)IntGetThreadFocusWindow());
+ ret = (DWORD_PTR)IntGetThreadFocusWindow();
+ break;
case THREADSTATE_CAPTUREWINDOW:
/* FIXME should use UserEnterShared */
- RETURN( (DWORD)IntGetCapture());
+ ret = (DWORD_PTR)IntGetCapture();
+ break;
case THREADSTATE_PROGMANWINDOW:
- RETURN( (DWORD)GetW32ThreadInfo()->Desktop->hProgmanWindow);
+ ret = (DWORD_PTR)GetW32ThreadInfo()->Desktop->hProgmanWindow;
+ break;
case THREADSTATE_TASKMANWINDOW:
- RETURN( (DWORD)GetW32ThreadInfo()->Desktop->hTaskManWindow);
+ ret = (DWORD_PTR)GetW32ThreadInfo()->Desktop->hTaskManWindow;
+ break;
case THREADSTATE_ACTIVEWINDOW:
- RETURN ( (DWORD)UserGetActiveWindow());
+ ret = (DWORD_PTR)UserGetActiveWindow();
+ break;
}
- RETURN( 0);
-CLEANUP:
- DPRINT("Leave NtUserGetThreadState, ret=%i\n",_ret_);
+ DPRINT("Leave NtUserGetThreadState, ret=%i\n", ret);
UserLeave();
- END_CLEANUP;
+
+ return ret;
}
NTSTATUS Status;
PTHRDCARETINFO CaretInfo;
GUITHREADINFO SafeGui;
- PDESKTOP_OBJECT Desktop;
+ PDESKTOP Desktop;
PUSER_MESSAGE_QUEUE MsgQueue;
PETHREAD Thread = NULL;
DECLARE_RETURN(BOOLEAN);
if(idThread)
{
- Status = PsLookupThreadByThreadId((HANDLE)idThread, &Thread);
+ Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)idThread, &Thread);
if(!NT_SUCCESS(Status))
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
RETURN( FALSE);
}
- Desktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop;
+ Desktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->Desktop;
}
else
{
/* get the foreground thread */
- PW32THREAD W32Thread = (PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread;
+ PTHREADINFO W32Thread = (PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread;
Desktop = W32Thread->Desktop;
if(Desktop)
{
(ULONG_PTR)W32Process->HeapMappings.UserMapping;
pi->psi = gpsi;
- if (InterlockedCompareExchangePointer(&W32Process->ProcessInfo,
+ if (InterlockedCompareExchangePointer((PVOID*)&W32Process->ProcessInfo,
pi,
NULL) != NULL)
{
{
PTEB Teb;
PW32THREADINFO ti;
- PW32CLIENTINFO ci;
- PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
+ PCLIENTINFO ci;
+ PTHREADINFO W32Thread = PsGetCurrentThreadWin32Thread();
if (W32Thread == NULL)
{
return NULL;
}
- /* allocate a W32THREAD structure if neccessary */
+ /* allocate a THREADINFO structure if neccessary */
if (W32Thread->ThreadInfo == NULL)
{
ti = UserHeapAlloc(sizeof(W32THREADINFO));
if (W32Thread->Desktop != NULL)
{
ti->Desktop = W32Thread->Desktop->DesktopInfo;
- ti->DesktopHeapBase = W32Thread->Desktop->DesktopInfo->hKernelHeap;
- ti->DesktopHeapLimit = W32Thread->Desktop->DesktopInfo->HeapLimit;
- ti->DesktopHeapDelta = DesktopHeapGetUserDelta();
}
else
{
ti->Desktop = NULL;
- ti->DesktopHeapBase = NULL;
- ti->DesktopHeapLimit = 0;
- ti->DesktopHeapDelta = 0;
}
W32Thread->ThreadInfo = ti;
/* update the TEB */
Teb = NtCurrentTeb();
- ci = ((PW32CLIENTINFO)Teb->Win32ClientInfo);
+ ci = GetWin32ClientInfo();
_SEH_TRY
{
ProbeForWrite(Teb,
}
HWND FASTCALL
- IntFindWindowToRepaint(PWINDOW_OBJECT Window, PW32THREAD Thread)
+ IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread)
{
HWND hChild;
PWINDOW_OBJECT TempWindow;
BOOL FASTCALL
IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
- PW32THREAD Thread, MSG *Message, BOOL Remove)
+ PTHREADINFO Thread, MSG *Message, BOOL Remove)
{
PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue;
HWND FASTCALL
co_IntFixCaret(PWINDOW_OBJECT Window, LPRECT lprc, UINT flags)
{
- PDESKTOP_OBJECT Desktop;
+ PDESKTOP Desktop;
PTHRDCARETINFO CaretInfo;
HWND hWndCaret;
PWINDOW_OBJECT WndCaret;
ASSERT_REFS_CO(Window);
- Desktop = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->Desktop;
+ Desktop = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->Desktop;
CaretInfo = ((PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue)->CaretInfo;
hWndCaret = CaretInfo->hWnd;
&& !(Wnd->ExStyle & WS_EX_TOOLWINDOW);
}
else
- HasIcon = (BOOL) hIcon;
+ HasIcon = (hIcon != 0);
IconWidth = UserGetSystemMetrics(SM_CXSIZE) + Padding;
/*
* @unimplemented
*/
-DWORD
+DWORD_PTR
STDCALL
NtUserCallNoParam(DWORD Routine)
{
- DWORD Result = 0;
- DECLARE_RETURN(DWORD);
+ DWORD_PTR Result = 0;
+ DECLARE_RETURN(DWORD_PTR);
DPRINT("Enter NtUserCallNoParam\n");
UserEnterExclusive();
switch(Routine)
{
case NOPARAM_ROUTINE_CREATEMENU:
- Result = (DWORD)UserCreateMenu(FALSE);
+ Result = (DWORD_PTR)UserCreateMenu(FALSE);
break;
case NOPARAM_ROUTINE_CREATEMENUPOPUP:
- Result = (DWORD)UserCreateMenu(TRUE);
+ Result = (DWORD_PTR)UserCreateMenu(TRUE);
break;
case NOPARAM_ROUTINE_DESTROY_CARET:
- Result = (DWORD)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
+ Result = (DWORD_PTR)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
break;
case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP:
- Result = (DWORD)IntInitMessagePumpHook();
+ Result = (DWORD_PTR)IntInitMessagePumpHook();
break;
case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP:
- Result = (DWORD)IntUninitMessagePumpHook();
+ Result = (DWORD_PTR)IntUninitMessagePumpHook();
break;
case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO:
- Result = (DWORD)MsqGetMessageExtraInfo();
+ Result = (DWORD_PTR)MsqGetMessageExtraInfo();
break;
case NOPARAM_ROUTINE_ANYPOPUP:
- Result = (DWORD)IntAnyPopup();
+ Result = (DWORD_PTR)IntAnyPopup();
break;
case NOPARAM_ROUTINE_CSRSS_INITIALIZED:
- Result = (DWORD)CsrInit();
+ Result = (DWORD_PTR)CsrInit();
break;
case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
- RETURN( (DWORD)IntMsqClearWakeMask());
+ RETURN( (DWORD_PTR)IntMsqClearWakeMask());
default:
DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
/*
* @implemented
*/
-DWORD
+DWORD_PTR
STDCALL
NtUserCallOneParam(
DWORD Param,
DWORD Routine)
{
- DECLARE_RETURN(DWORD);
+ DECLARE_RETURN(DWORD_PTR);
DPRINT("Enter NtUserCallOneParam\n");
switch(Routine)
{
case ONEPARAM_ROUTINE_SHOWCURSOR:
- RETURN( (DWORD)UserShowCursor((BOOL)Param) );
+ RETURN( (DWORD_PTR)UserShowCursor((BOOL)Param) );
case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
{
{
/* Try convert the pointer to a user mode pointer if the desktop is
mapped into the process */
- RETURN((DWORD)DesktopHeapAddressToUser((PVOID)Param));
+ RETURN((DWORD_PTR)DesktopHeapAddressToUser((PVOID)Param));
}
else
{
case ONEPARAM_ROUTINE_GETMENU:
{
PWINDOW_OBJECT Window;
- DWORD Result;
+ DWORD_PTR Result;
if(!(Window = UserGetWindowObject((HWND)Param)))
{
RETURN( FALSE);
}
- Result = (DWORD)Window->Wnd->IDMenu;
+ Result = Window->Wnd->IDMenu;
RETURN( Result);
}
case ONEPARAM_ROUTINE_ISWINDOWUNICODE:
{
PWINDOW_OBJECT Window;
- DWORD Result;
+ DWORD_PTR Result;
Window = UserGetWindowObject((HWND)Param);
if(!Window)
}
case ONEPARAM_ROUTINE_WINDOWFROMDC:
- RETURN( (DWORD)IntWindowFromDC((HDC)Param));
+ RETURN( (DWORD_PTR)IntWindowFromDC((HDC)Param));
case ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID:
{
PWINDOW_OBJECT Window;
- DWORD Result;
+ DWORD_PTR Result;
Window = UserGetWindowObject((HWND)Param);
if(!Window)
{
PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
- DWORD Result;
+ DWORD_PTR Result;
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
KernelMode,
0,
&WinSta);
if (!NT_SUCCESS(Status))
- RETURN( (DWORD)FALSE);
+ RETURN( (DWORD_PTR)FALSE);
/* FIXME
- Result = (DWORD)IntSwapMouseButton(WinStaObject, (BOOL)Param); */
+ Result = (DWORD_PTR)IntSwapMouseButton(WinStaObject, (BOOL)Param); */
Result = 0;
ObDereferenceObject(WinSta);
}
case ONEPARAM_ROUTINE_SWITCHCARETSHOWING:
- RETURN( (DWORD)IntSwitchCaretShowing((PVOID)Param));
+ RETURN( (DWORD_PTR)IntSwitchCaretShowing((PVOID)Param));
case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
- RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
+ RETURN( (DWORD_PTR)IntSetCaretBlinkTime((UINT)Param));
case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
{
RETURN( FALSE);
}
- Result = (DWORD)Window->Wnd->Instance;
+ Result = (DWORD_PTR)Window->Wnd->Instance;
RETURN( Result);
}
case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
- RETURN( (DWORD)MsqSetMessageExtraInfo((LPARAM)Param));
+ RETURN( (DWORD_PTR)MsqSetMessageExtraInfo((LPARAM)Param));
case ONEPARAM_ROUTINE_CREATECURICONHANDLE:
{
}
ObDereferenceObject(WinSta);
- RETURN((DWORD)CurIcon->Self);
+ RETURN((DWORD_PTR)CurIcon->Self);
}
case ONEPARAM_ROUTINE_GETCURSORPOSITION:
POINT Pos;
if(!Param)
- RETURN( (DWORD)FALSE);
+ RETURN( (DWORD_PTR)FALSE);
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
KernelMode,
0,
&WinSta);
if (!NT_SUCCESS(Status))
- RETURN( (DWORD)FALSE);
+ RETURN( (DWORD_PTR)FALSE);
/* FIXME - check if process has WINSTA_READATTRIBUTES */
IntGetCursorLocation(WinSta, &Pos);
ObDereferenceObject(WinSta);
- RETURN( (DWORD)TRUE);
+ RETURN( (DWORD_PTR)TRUE);
}
case ONEPARAM_ROUTINE_ISWINDOWINDESTROY:
{
PWINDOW_OBJECT Window;
- DWORD Result;
+ DWORD_PTR Result;
if(!(Window = UserGetWindowObject((HWND)Param)))
{
RETURN( FALSE);
}
- Result = (DWORD)IntIsWindowInDestroy(Window);
+ Result = (DWORD_PTR)IntIsWindowInDestroy(Window);
RETURN( Result);
}
}
case ONEPARAM_ROUTINE_MSQSETWAKEMASK:
- RETURN( (DWORD)IntMsqSetWakeMask(Param));
+ RETURN( (DWORD_PTR)IntMsqSetWakeMask(Param));
case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
RETURN( UserGetKeyboardType(Param));
case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
- RETURN( (DWORD)UserGetKeyboardLayout(Param));
+ RETURN( (DWORD_PTR)UserGetKeyboardLayout(Param));
case ONEPARAM_ROUTINE_REGISTERUSERMODULE:
{
/*
* @implemented
*/
-DWORD
+DWORD_PTR
STDCALL
NtUserCallTwoParam(
DWORD Param1,
{
NTSTATUS Status;
PWINDOW_OBJECT Window;
- DECLARE_RETURN(DWORD);
+ DECLARE_RETURN(DWORD_PTR);
DPRINT("Enter NtUserCallTwoParam\n");
UserEnterExclusive();
{
case TWOPARAM_ROUTINE_GETWINDOWRGNBOX:
{
- DWORD Ret;
+ DWORD_PTR Ret;
RECT rcRect;
Window = UserGetWindowObject((HWND)Param1);
if (!Window) RETURN(ERROR);
- Ret = (DWORD)IntGetWindowRgnBox(Window, &rcRect);
+ Ret = (DWORD_PTR)IntGetWindowRgnBox(Window, &rcRect);
Status = MmCopyToCaller((PVOID)Param2, &rcRect, sizeof(RECT));
if(!NT_SUCCESS(Status))
{
Window = UserGetWindowObject((HWND)Param1);
if (!Window) RETURN(ERROR);
- RETURN( (DWORD)IntGetWindowRgn(Window, (HRGN)Param2));
+ RETURN( (DWORD_PTR)IntGetWindowRgn(Window, (HRGN)Param2));
}
case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
{
- DWORD Ret;
+ DWORD_PTR Ret;
PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
if(!MenuObject)
RETURN( 0);
MenuObject->MenuInfo.Height = (int)Param2;
}
else
- Ret = (DWORD)MenuObject->MenuInfo.Height;
+ Ret = (DWORD_PTR)MenuObject->MenuInfo.Height;
IntReleaseMenuObject(MenuObject);
RETURN( Ret);
}
Ret = IntSetMenuItemRect(MenuObject, smir.uItem, smir.fByPosition, &smir.rcRect);
IntReleaseMenuObject(MenuObject);
- RETURN( (DWORD)Ret);
+ RETURN( (DWORD_PTR)Ret);
}
case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
{
- PUSER_MESSAGE_QUEUE MsgQueue = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
+ PUSER_MESSAGE_QUEUE MsgQueue = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
ASSERT(MsgQueue);
- RETURN( (DWORD)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
+ RETURN( (DWORD_PTR)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
}
case TWOPARAM_ROUTINE_ENABLEWINDOW:
Window = UserGetWindowObject((HWND)Param1);
if (!Window) RETURN(0);
- RETURN( (DWORD)IntShowOwnedPopups(Window, (BOOL) Param2));
+ RETURN( (DWORD_PTR)IntShowOwnedPopups(Window, (BOOL) Param2));
}
case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE:
if(!(Window = UserGetWindowObject((HWND)Param1)))
{
- RETURN( (DWORD)FALSE);
+ RETURN( (DWORD_PTR)FALSE);
}
Window->Wnd->ContextHelpId = Param2;
- RETURN( (DWORD)TRUE);
+ RETURN( (DWORD_PTR)TRUE);
case TWOPARAM_ROUTINE_SETCARETPOS:
- RETURN( (DWORD)co_IntSetCaretPos((int)Param1, (int)Param2));
+ RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
case TWOPARAM_ROUTINE_GETWINDOWINFO:
{
WINDOWINFO wi;
- DWORD Ret;
+ DWORD_PTR Ret;
if(!(Window = UserGetWindowObject((HWND)Param1)))
{
}
#endif
- if((Ret = (DWORD)IntGetWindowInfo(Window, &wi)))
+ if((Ret = (DWORD_PTR)IntGetWindowInfo(Window, &wi)))
{
Status = MmCopyToCaller((PVOID)Param2, &wi, sizeof(WINDOWINFO));
if(!NT_SUCCESS(Status))
}
case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
- RETURN( (DWORD)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
+ RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES:
case TWOPARAM_ROUTINE_GETSYSCOLORPENS:
case TWOPARAM_ROUTINE_GETSYSCOLORS:
{
- DWORD Ret = 0;
+ DWORD_PTR Ret = 0;
union
{
PVOID Pointer;
switch(Routine)
{
case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES:
- Ret = (DWORD)IntGetSysColorBrushes(Buffer.Brushes, (UINT)Param2);
+ Ret = (DWORD_PTR)IntGetSysColorBrushes(Buffer.Brushes, (UINT)Param2);
break;
case TWOPARAM_ROUTINE_GETSYSCOLORPENS:
- Ret = (DWORD)IntGetSysColorPens(Buffer.Pens, (UINT)Param2);
+ Ret = (DWORD_PTR)IntGetSysColorPens(Buffer.Pens, (UINT)Param2);
break;
case TWOPARAM_ROUTINE_GETSYSCOLORS:
- Ret = (DWORD)IntGetSysColors(Buffer.Colors, (UINT)Param2);
+ Ret = (DWORD_PTR)IntGetSysColors(Buffer.Colors, (UINT)Param2);
break;
default:
Ret = 0;
case TWOPARAM_ROUTINE_ROS_REGSYSCLASSES:
{
- DWORD Ret = 0;
+ DWORD_PTR Ret = 0;
DWORD Count = Param1;
PREGISTER_SYSCLASS RegSysClassArray = (PREGISTER_SYSCLASS)Param2;
Count,
2);
- Ret = (DWORD)UserRegisterSystemClasses(Count,
+ Ret = (DWORD_PTR)UserRegisterSystemClasses(Count,
RegSysClassArray);
}
_SEH_HANDLE
newExtension = ".rc";
else if ( extension == ".spec" || extension == ".SPEC" )
newExtension = ".stubs.o";
+ else if ( extension == ".pspec" || extension == ".PSPEC" )
+ newExtension = ".stubs.o";
else if ( extension == ".idl" || extension == ".IDL" )
{
if ( module.type == RpcServer )
if ( !module.pch || !use_pch )
return NULL;
return new FileLocation ( IntermediateDirectory,
- module.pch->file->relative_path,
+ module.pch->file->relative_path + "/.gch_" + module.name,
module.pch->file->name + ".gch" );
}
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule winebuildPCRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+ "\t$(ECHO_WINEBLD)\n"
+ "\t${gcc} -xc -E $(source) -I. > $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
+ "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
+ "$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
+ "\t$(ECHO_WINEBLD)\n"
+ "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+ "\t$(ECHO_CC)\n"
+ "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec",
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
+ "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
"\t$(ECHO_WINEBLD)\n"
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(source)\n"
string
MingwModuleHandler::GetPropertyValue ( const Module& module, const std::string& name )
{
- for ( size_t i = 0; i < module.project.non_if_data.properties.size (); i++ )
- {
- const Property& property = *module.project.non_if_data.properties[i];
- if ( property.name == name )
- return property.value;
- }
- return string ( "" );
+ const Property* property = module.project.LookupProperty(name);
+
+ if (property)
+ return property->value;
+ else
+ return string ( "" );
}
/* caller needs to delete the returned object */
{ HostDontCare, TypeDontCare, ".mc", &wmcRule },
{ HostFalse, Kernel, ".spec", &winebuildKMRule },
{ HostFalse, KernelModeDLL, ".spec", &winebuildKMRule },
+ { HostDontCare, TypeDontCare, ".pspec", &winebuildPCRule },
{ HostDontCare, TypeDontCare, ".spec", &winebuildRule },
{ HostDontCare, RpcServer, ".idl", &widlServerRule },
{ HostDontCare, RpcClient, ".idl", &widlClientRule },
if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
return;
- if (module.name != "psdk" &&
+ if (module.name != "psdk" &&
module.name != "dxsdk")
{
dependencies.push_back ( "$(PSDK_TARGET) $(psdk_HEADERS)" );
dependencies.push_back ( "$(DXSDK_TARGET) $(dxsdk_HEADERS)" );
}
- if (module.name != "errcodes" &&
+ if (module.name != "errcodes" &&
module.name != "bugcodes" &&
module.name != "ntstatus")
{
MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
const string& bootcdDirectory )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
MingwIsoModuleHandler::GetBootstrapCdDirectories ( vector<FileLocation>& out,
const string& bootcdDirectory )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
MingwIsoModuleHandler::GetBootstrapCdFiles (
vector<FileLocation>& out ) const
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
vSourceFiles.push_back ( reactosDff );
- /*
+ /*
We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
- Iso/LiveIso outputs are generated in code base root
+ Iso/LiveIso outputs are generated in code base root
*/
string IsoName = module.output->name;
MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,
string& reactosDirectory )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.install )
const FileLocation *isoboot = bootModule->output;
- /*
+ /*
We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
- Iso/LiveIso outputs are generated in code base root
+ Iso/LiveIso outputs are generated in code base root
*/
IsoName = module.output->name;
string targetMacro ( GetTargetMacro (module) );
GenerateRules ();
-
+
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: $(CABMAN_TARGET) | %s\n",
targetMacro.c_str (),
{
}
- void IfableData::ExtractModules( std::vector<Module*> &modules )
+ void IfableData::ExtractModules( std::map<std::string, Module*> &modules )
{
size_t i;
for ( i = 0; i < this->modules.size (); i++ )
- modules.push_back(this->modules[i]);
+ modules.insert(std::make_pair(this->modules[i]->name, this->modules[i]));
}
IfableData::~IfableData()
delete defines[i];
for ( i = 0; i < libraries.size (); i++ )
delete libraries[i];
- for ( i = 0; i < properties.size (); i++ )
- delete properties[i];
+ for ( std::map<std::string, Property*>::const_iterator p = properties.begin(); p != properties.end(); ++ p )
+ delete p->second;
for ( i = 0; i < compilerFlags.size (); i++ )
delete compilerFlags[i];
for ( i = 0; i < modules.size(); i++ )
defines[i]->ProcessXML ();
for ( i = 0; i < libraries.size (); i++ )
libraries[i]->ProcessXML ();
- for ( i = 0; i < properties.size(); i++ )
- properties[i]->ProcessXML ();
+ for ( std::map<std::string, Property*>::const_iterator p = properties.begin(); p != properties.end(); ++ p )
+ p->second->ProcessXML ();
for ( i = 0; i < compilerFlags.size(); i++ )
compilerFlags[i]->ProcessXML ();
for ( i = 0; i < compilationUnits.size (); i++ )
if ( autoRegister )
delete autoRegister;
if ( output )
- delete output;
+ delete output;
}
void
return "DllMainCRTStartup@12";
case NativeCUI:
if (Environment::GetArch() == "arm") return "NtProcessStartup";
- return "NtProcessStartup@4";
+ return "NtProcessStartup@4";
case Win32DLL:
case Win32OCX:
if (Environment::GetArch() == "arm") return "DllMain";
result = "_";
result += entrypoint;
+
+ if (Environment::GetArch() == "amd64")
+ {
+ size_t at_index = result.find_last_of( '@' );
+ if ( at_index != result.npos )
+ return result.substr (0, at_index );
+ }
+
return result;
}
}
}
+ const var_t* get_context_handle_var(const func_t* func)
+ {
+ const var_t* var;
+
+ if (!func->args)
+ return NULL;
+
+ LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
+ if (is_attr(var->attrs, ATTR_IN) && is_context_handle(var->type))
+ return var;
+
+ return NULL;
+ }
+
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{
const func_t *func;
{
const var_t *def = func->def;
const var_t* explicit_handle_var;
+ const var_t* explicit_generic_handle_var = NULL;
+ const var_t* context_handle_var = NULL;
int has_full_pointer = is_full_pointer_function(func);
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
+ if (!explicit_handle_var)
+ {
+ explicit_generic_handle_var = get_explicit_generic_handle_var(func);
+ if (!explicit_generic_handle_var)
+ context_handle_var = get_context_handle_var(func);
+ }
if (explicit_handle)
{
- if (!explicit_handle_var)
+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
}
}
- write_type_decl_left(client, def->type);
- if (needs_space_after(def->type))
+ write_type_decl_left(client, get_func_return_type(func));
+ if (needs_space_after(get_func_return_type(func)))
fprintf(client, " ");
write_prefix_name(client, prefix_client, def);
fprintf(client, "(\n");
indent++;
/* declare return value '_RetVal' */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
{
print_client("");
- write_type_decl_left(client, def->type);
+ write_type_decl_left(client, get_func_return_type(func));
fprintf(client, " _RetVal;\n");
}
- if (implicit_handle || explicit_handle_var)
+ if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
print_client("RPC_BINDING_HANDLE _Handle = 0;\n");
print_client("RPC_MESSAGE _RpcMessage;\n");
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
- if (!is_void(def->type) && decl_indirect(def->type))
+ if (!is_void(get_func_return_type(func)) && decl_indirect(get_func_return_type(func)))
{
print_client("void *_p_%s = &%s;\n",
"_RetVal", "_RetVal");
print_client("_Handle = %s;\n", explicit_handle_var->name);
fprintf(client, "\n");
}
+ else if (explicit_generic_handle_var)
+ {
+ print_client("_Handle = %s_bind(%s);\n",
+ get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
+ explicit_generic_handle_var->name);
+ fprintf(client, "\n");
+ }
+ else if (context_handle_var)
+ {
+ /* if the context_handle attribute appears in the chain of types
+ * without pointers being followed, then the context handle must
+ * be direct, otherwise it is a pointer */
+ int is_ch_ptr = is_aliaschain_attr(context_handle_var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
+ print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", context_handle_var->name);
+ indent++;
+ print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ch_ptr ? "*" : "", context_handle_var->name);
+ indent--;
+ fprintf(client, "\n");
+ }
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE);
indent++;
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("_StubMsg.BufferLength,\n");
- if (implicit_handle || explicit_handle_var)
+ if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
print_client("_Handle);\n");
else
print_client("%s__MIDL_AutoBindHandle);\n", iface->name);
write_remoting_arguments(client, indent, func, PASS_OUT, PHASE_UNMARSHAL);
/* unmarshal return value */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
{
- if (decl_indirect(def->type))
+ if (decl_indirect(get_func_return_type(func)))
print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal");
- else if (is_ptr(def->type) || is_array(def->type))
+ else if (is_ptr(get_func_return_type(func)) || is_array(get_func_return_type(func)))
print_client("%s = 0;\n", "_RetVal");
write_remoting_arguments(client, indent, func, PASS_RETURN, PHASE_UNMARSHAL);
}
if (func->args)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
- *proc_offset += get_size_procformatstring_var(var);
+ *proc_offset += get_size_procformatstring_type(var->name, var->type, var->attrs);
}
- if (!is_void(def->type))
- *proc_offset += get_size_procformatstring_var(def);
+ if (!is_void(get_func_return_type(func)))
+ *proc_offset += get_size_procformatstring_type("return value", get_func_return_type(func), NULL);
else
*proc_offset += 2; /* FC_END and FC_PAD */
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
+ if (!implicit_handle && explicit_generic_handle_var)
+ {
+ fprintf(client, "\n");
+ print_client("if (_Handle)\n");
+ indent++;
+ print_client("%s_unbind(%s, _Handle);\n",
+ get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
+ explicit_generic_handle_var->name);
+ indent--;
+ }
+
indent--;
print_client("}\n");
print_client("RpcEndFinally\n");
/* emit return code */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
{
fprintf(client, "\n");
print_client("return _RetVal;\n");
write_function_stubs(iface->iface, &proc_offset);
print_client("#if !defined(__RPC_WIN32__)\n");
- print_client("#error Invalid build platform for this stub.\n");
+ print_client("//#error Invalid build platform for this stub.\n");
print_client("#endif\n");
fprintf(client, "\n");
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
{
const var_t *def = func->def;
+ const var_t* context_handle_var = NULL;
+ const var_t* explicit_generic_handle_var = NULL;
int has_full_pointer = is_full_pointer_function(func);
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
+ if (!explicit_handle_var)
+ {
+ explicit_generic_handle_var = get_explicit_generic_handle_var(func);
+ if (!explicit_generic_handle_var)
+ context_handle_var = get_context_handle_var(func);
+ }
if (explicit_handle)
{
- if (!explicit_handle_var)
+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
assign_stub_out_args(server, indent, func);
/* Call the real server function */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
print_server("_RetVal = ");
else
print_server("");
fprintf(server, ",\n");
if (is_context_handle(var->type))
{
+ /* if the context_handle attribute appears in the chain of types
+ * without pointers being followed, then the context handle must
+ * be direct, otherwise it is a pointer */
+ int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_server("(");
write_type_decl_left(server, var->type);
- fprintf(server, ")%sNDRSContextValue(%s)", is_ptr(var->type) ? "" : "*", var->name);
+ fprintf(server, ")%sNDRSContextValue(%s)", is_ch_ptr ? "" : "*", var->name);
}
else
{
{
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_BUFFERSIZE);
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_BUFFERSIZE);
print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n");
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_MARSHAL);
/* marshall the return value */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_MARSHAL);
indent--;
write_function_stubs(iface->iface, &proc_offset);
print_server("#if !defined(__RPC_WIN32__)\n");
- print_server("#error Invalid build platform for this stub.\n");
+ print_server("//#error Invalid build platform for this stub.\n");
print_server("#endif\n");
fprintf(server, "\n");
static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type,
const char *name, int write_ptr, unsigned int *tfsoff);
static const var_t *find_array_or_string_in_struct(const type_t *type);
+ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs,
+ type_t *type,
+ const char *name, unsigned int *typestring_offset);
const char *string_of_type(unsigned char type)
{
else if (is_struct(type->type))
{
const var_t *field;
- if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
if (type_has_pointers(field->type))
return TRUE;
const var_t *field;
if (type->type == RPC_FC_ENCAPSULATED_UNION)
{
- const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
- fields = uv->type->fields;
+ const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
+ fields = uv->type->fields_or_args;
}
else
- fields = type->fields;
+ fields = type->fields_or_args;
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
if (field->type && type_has_pointers(field->type))
else if (is_struct(type->type))
{
const var_t *field;
- if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
if (type_has_full_pointer(field->type))
return TRUE;
const var_t *field;
if (type->type == RPC_FC_ENCAPSULATED_UNION)
{
- const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
- fields = uv->type->fields;
+ const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
+ fields = uv->type->fields_or_args;
}
else
- fields = type->fields;
+ fields = type->fields_or_args;
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
if (field->type && type_has_full_pointer(field->type))
{
const var_t *var;
- if (!is_void(func->def->type))
- write_var_init(file, indent, func->def->type, "_RetVal");
+ if (!is_void(get_func_return_type(func)))
+ write_var_init(file, indent, get_func_return_type(func), "_RetVal");
if (!func->args)
return;
&& !is_array(t));
}
- static size_t write_procformatstring_var(FILE *file, int indent,
- const var_t *var, int is_return)
+ static size_t write_procformatstring_type(FILE *file, int indent,
+ const char *name,
+ const type_t *type,
+ const attr_list_t *attrs,
+ int is_return)
{
size_t size;
- const type_t *type = var->type;
- int is_in = is_attr(var->attrs, ATTR_IN);
- int is_out = is_attr(var->attrs, ATTR_OUT);
+ int is_in = is_attr(attrs, ATTR_IN);
+ int is_out = is_attr(attrs, ATTR_OUT);
if (!is_in && !is_out) is_in = TRUE;
}
else
{
- error("Unknown/unsupported type: %s (0x%02x)\n", var->name, type->type);
+ error("Unknown/unsupported type: %s (0x%02x)\n", name, type->type);
size = 0;
}
}
if (func->args)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
- write_procformatstring_var(file, indent, var, FALSE);
+ write_procformatstring_type(file, indent, var->name, var->type, var->attrs, FALSE);
}
/* emit return value data */
- var = func->def;
- if (is_void(var->type))
+ if (is_void(get_func_return_type(func)))
{
print_file(file, indent, "0x5b, /* FC_END */\n");
print_file(file, indent, "0x5c, /* FC_PAD */\n");
}
else
- write_procformatstring_var(file, indent, var, TRUE);
+ write_procformatstring_type(file, indent, "return value", get_func_return_type(func), NULL, TRUE);
}
}
}
size_t offset = 0;
const var_t *var;
- if (structure->fields) LIST_FOR_EACH_ENTRY( var, structure->fields, const var_t, entry )
+ if (structure->fields_or_args) LIST_FOR_EACH_ENTRY( var, structure->fields_or_args, const var_t, entry )
{
unsigned int align = 0;
/* FIXME: take alignment into account */
case RPC_FC_CSTRUCT:
case RPC_FC_PSTRUCT:
case RPC_FC_BOGUS_STRUCT:
- size = fields_memsize(t->fields, align);
+ size = fields_memsize(t->fields_or_args, align);
break;
case RPC_FC_ENCAPSULATED_UNION:
case RPC_FC_NON_ENCAPSULATED_UNION:
- size = union_memsize(t->fields, align);
+ size = union_memsize(t->fields_or_args, align);
break;
case RPC_FC_SMFARRAY:
case RPC_FC_LGFARRAY:
int is_full_pointer_function(const func_t *func)
{
const var_t *var;
- if (type_has_full_pointer(func->def->type))
+ if (type_has_full_pointer(get_func_return_type(func)))
return TRUE;
if (!func->args)
return FALSE;
return 4;
}
- static unsigned char conf_string_type_of_char_type(unsigned char t)
- {
- switch (t)
- {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- return RPC_FC_C_CSTRING;
- case RPC_FC_WCHAR:
- return RPC_FC_C_WSTRING;
- }
-
- error("string_type_of_char_type: unrecognized type %d\n", t);
- return 0;
- }
-
static unsigned int write_simple_pointer(FILE *file, const type_t *type)
{
- unsigned char fc
- = is_string_type(type->attrs, type)
- ? conf_string_type_of_char_type(type->ref->type)
- : type->ref->type;
+ unsigned char fc = type->ref->type;
+ /* for historical reasons, write_simple_pointer also handled string types,
+ * but no longer does. catch bad uses of the function with this check */
+ if (is_string_type(type->attrs, type))
+ error("write_simple_pointer: can't handle type %s which is a string type\n", type->name);
print_file(file, 2, "0x%02x, 0x8,\t/* %s [simple_pointer] */\n",
type->type, string_of_type(type->type));
print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc));
static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
{
unsigned int offset = 0;
- var_list_t *fs = type->fields;
+ var_list_t *fs = type->fields_or_args;
var_t *f;
if (fs) LIST_FOR_EACH_ENTRY(f, fs, var_t, entry)
*typestring_offset += 6;
if (is_ptr(type))
- write_pointer_tfs(file, type, typestring_offset);
+ {
+ if (is_string_type(type->attrs, type))
+ write_string_tfs(file, NULL, type, NULL, typestring_offset);
+ else
+ write_pointer_tfs(file, type, typestring_offset);
+ }
else
{
unsigned absoff = type->typestring_offset;
if (is_non_complex_struct(type))
{
const var_t *v;
- LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
+ LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
written += write_no_repeat_pointer_descriptions(
file, v->type,
offset_in_memory, offset_in_buffer, typestring_offset);
}
*typestring_offset += 4;
- if (processed(type->ref) || is_base_type(type->ref->type))
+ if (is_string_type(attrs, type))
+ write_string_tfs(file, NULL, type, NULL, typestring_offset);
+ else if (processed(type->ref) || is_base_type(type->ref->type))
write_pointer_tfs(file, type, typestring_offset);
else
error("write_pointer_description_offsets: type format string unknown\n");
{
/* otherwise search for interesting fields to parse */
const var_t *v;
- LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
+ LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
{
written += write_pointer_description_offsets(
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
else if (is_struct(type->type))
{
const var_t *v;
- LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
+ LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
{
pointer_count += write_fixed_array_pointer_descriptions(
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
else if (is_struct(type->type))
{
const var_t *v;
- LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
+ LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
{
pointer_count += write_varying_array_pointer_descriptions(
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
static size_t write_string_tfs(FILE *file, const attr_list_t *attrs,
type_t *type,
- const char *name, unsigned int *typestring_offset,
- int toplevel)
+ const char *name, unsigned int *typestring_offset)
{
size_t start_offset;
unsigned char rtype;
- if (toplevel && is_declptr(type))
+ if (is_declptr(type))
{
unsigned char flag = is_conformant_array(type) ? 0 : RPC_FC_P_SIMPLEPOINTER;
int pointer_type = is_ptr(type) ? type->type : get_attrv(attrs, ATTR_POINTERTYPE);
if (!pointer_type)
pointer_type = RPC_FC_RP;
+ print_start_tfs_comment(file, type, *typestring_offset);
print_file(file, 2,"0x%x, 0x%x,\t/* %s%s */\n",
pointer_type, flag, string_of_type(pointer_type),
flag ? " [simple_pointer]" : "");
static const var_t *find_array_or_string_in_struct(const type_t *type)
{
- const var_t *last_field = LIST_ENTRY( list_tail(type->fields), const var_t, entry );
+ const var_t *last_field = LIST_ENTRY( list_tail(type->fields_or_args), const var_t, entry );
const type_t *ft = last_field->type;
if (ft->declarray && is_conformant_array(ft))
int salign = -1;
int padding;
- if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
type_t *ft = field->type;
if (!ft->declarray || !is_conformant_array(ft))
error("structure size for %s exceeds %d bytes by %d bytes\n",
name, USHRT_MAX, total_size - USHRT_MAX);
- if (type->fields) LIST_FOR_EACH_ENTRY(f, type->fields, var_t, entry)
+ if (type->fields_or_args) LIST_FOR_EACH_ENTRY(f, type->fields_or_args, var_t, entry)
has_pointers |= write_embedded_types(file, f->attrs, f->type, f->name,
FALSE, tfsoff);
if (!has_pointers) has_pointers = type_has_pointers(type);
if (array && !processed(array->type))
array_offset
= is_attr(array->attrs, ATTR_STRING)
- ? write_string_tfs(file, array->attrs, array->type, array->name, tfsoff, FALSE)
+ ? write_string_tfs(file, array->attrs, array->type, array->name, tfsoff)
: write_array_tfs(file, array->attrs, array->type, array->name, tfsoff);
corroff = *tfsoff;
if (type->type == RPC_FC_BOGUS_STRUCT)
{
- const var_list_t *fs = type->fields;
+ const var_list_t *fs = type->fields_or_args;
const var_t *f;
type->ptrdesc = *tfsoff;
{
type_t *ft = f->type;
if (is_ptr(ft))
- write_pointer_tfs(file, ft, tfsoff);
+ {
+ if (is_string_type(f->attrs, ft))
+ write_string_tfs(file, f->attrs, ft, f->name, tfsoff);
+ else
+ write_pointer_tfs(file, ft, tfsoff);
+ }
else if (!ft->declarray && is_conformant_array(ft))
{
unsigned int absoff = ft->typestring_offset;
if (type->type == RPC_FC_ENCAPSULATED_UNION)
{
- const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
- fields = uv->type->fields;
+ const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
+ fields = uv->type->fields_or_args;
}
else
- fields = type->fields;
+ fields = type->fields_or_args;
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
{
print_start_tfs_comment(file, type, start_offset);
if (type->type == RPC_FC_ENCAPSULATED_UNION)
{
- const var_t *sv = LIST_ENTRY(list_head(type->fields), const var_t, entry);
+ const var_t *sv = LIST_ENTRY(list_head(type->fields_or_args), const var_t, entry);
const type_t *st = sv->type;
switch (st->type)
return type->typestring_offset;
}
- if ((last_ptr(type) || last_array(type)) && is_ptrchain_attr(var, ATTR_STRING))
- return write_string_tfs(file, var->attrs, type, var->name, typeformat_offset, TRUE);
+ if (is_string_type(var->attrs, type))
+ return write_string_tfs(file, var->attrs, type, var->name, typeformat_offset);
if (is_array(type))
{
{
write_user_tfs(file, type, tfsoff);
}
+ else if (is_string_type(attrs, type))
+ {
+ write_string_tfs(file, attrs, type, name, tfsoff);
+ }
else if (is_ptr(type))
{
type_t *ref = type->ref;
retmask |= 1;
}
}
- else if (last_array(type) && is_attr(attrs, ATTR_STRING))
- {
- write_string_tfs(file, attrs, type, name, tfsoff, FALSE);
- }
else if (type->declarray && is_conformant_array(type))
; /* conformant arrays and strings are handled specially */
else if (is_array(type))
{
if (is_local(func->def->attrs)) continue;
- if (!is_void(func->def->type))
- update_tfsoff(func->def->type,
+ if (!is_void(get_func_return_type(func)))
+ {
+ var_t v = *func->def;
+ v.type = get_func_return_type(func);
+ update_tfsoff(get_func_return_type(func),
write_typeformatstring_var(
- file, 2, NULL, func->def->type,
- func->def, &typeformat_offset),
+ file, 2, NULL, get_func_return_type(func),
+ &v, &typeformat_offset),
file);
+ }
current_func = func;
if (func->args)
{
size_t size = 0;
const var_t *field;
- if (!type->fields) return 0;
- LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (!type->fields_or_args) return 0;
+ LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
unsigned int alignment;
size += get_required_buffer_size_type(field->type, field->name,
const var_t *field;
unsigned int size = 36;
- if (!type->fields) return size;
- LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (!type->fields_or_args) return size;
+ LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
unsigned int align;
size += get_required_buffer_size_type(
unsigned int size = 36;
const var_t *field;
- if (!type->fields) return size;
- LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ if (!type->fields_or_args) return size;
+ LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
{
unsigned int align;
size += get_required_buffer_size_type(
}
}
- if (pass == PASS_OUT && !is_void(func->def->type))
+ if (pass == PASS_OUT && !is_void(get_func_return_type(func)))
{
- total_size += get_required_buffer_size(func->def, &alignment, PASS_RETURN);
+ var_t v = *func->def;
+ v.type = get_func_return_type(func);
+ total_size += get_required_buffer_size(&v, &alignment, PASS_RETURN);
total_size += alignment;
}
return total_size;
}
if (phase == PHASE_MARSHAL)
- print_file(file, indent, "MIDL_memset(_StubMsg.Buffer, 0, (0x%x - (long)_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
- print_file(file, indent, "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + %u) & ~0x%x);\n",
+ print_file(file, indent, "MIDL_memset(_StubMsg.Buffer, 0, (0x%x - (size_t)_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
+ print_file(file, indent, "_StubMsg.Buffer = (unsigned char *)(((size_t)_StubMsg.Buffer + %u) & ~0x%x);\n",
alignment - 1, alignment - 1);
if (phase == PHASE_MARSHAL)
{
if (pass == PASS_IN)
{
+ /* if the context_handle attribute appears in the chain of types
+ * without pointers being followed, then the context handle must
+ * be direct, otherwise it is a pointer */
+ int is_ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_file(file, indent, "NdrClientContextMarshall(\n");
print_file(file, indent + 1, "&_StubMsg,\n");
- print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ptr(type) ? "*" : "", var->name);
+ print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ch_ptr ? "*" : "", var->name);
print_file(file, indent + 1, "%s);\n", in_attr && out_attr ? "1" : "0");
}
else
{
var_t var;
var = *func->def;
+ var.type = get_func_return_type(func);
var.name = xstrdup( "_RetVal" );
write_remoting_arg( file, indent, func, pass, phase, &var );
free( var.name );
}
- size_t get_size_procformatstring_var(const var_t *var)
+ size_t get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs)
{
- return write_procformatstring_var(NULL, 0, var, FALSE);
+ return write_procformatstring_type(NULL, 0, name, type, attrs, FALSE);
}
/* argument list size */
if (func->args)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
- size += get_size_procformatstring_var(var);
+ size += get_size_procformatstring_type(var->name, var->type, var->attrs);
/* return value size */
- if (is_void(func->def->type))
+ if (is_void(get_func_return_type(func)))
size += 2; /* FC_END and FC_PAD */
else
- size += get_size_procformatstring_var(func->def);
+ size += get_size_procformatstring_type("return value", get_func_return_type(func), NULL);
return size;
}
{
int in_attr, out_attr;
int i = 0;
- const var_t *def = func->def;
const var_t *var;
/* declare return value '_RetVal' */
- if (!is_void(def->type))
+ if (!is_void(get_func_return_type(func)))
{
print_file(file, indent, "");
- write_type_decl_left(file, def->type);
+ write_type_decl_left(file, get_func_return_type(func));
fprintf(file, " _RetVal;\n");
}
LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry)
{
const char *name = eval->structure->name;
- const var_list_t *fields = eval->structure->fields;
+ const var_list_t *fields = eval->structure->fields_or_args;
result = 1;
print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",