Author: cfinck
Date: Wed Jun 24 16:26:33 2015
New Revision: 68253
URL: http://svn.reactos.org/svn/reactos?rev=68253&view=rev
Log:
[SPOOLSS]
Halfplement and document the undocumented but exported MarshallDownStructure API.
Information about this API was exclusively gained by writing a custom XML file for rohitab.com's API Monitor and monitoring calls under Windows.
I could figure out the parameters passed to the function, but don't really know what most of them are for.
For me, the function does what it should and what I will soon need it for, but without making use of cbSize, cbPerElementSize, cbStructureSize and bSomeBoolean.
A Code Review and additional hints are highly appreciated! My XML file for the API Monitor is available on request.
Modified:
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/spoolss.spec
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/tools.c
branches/colins-printing-for-freedom/reactos/win32ss/printing/include/spoolss.h
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/spoolss.spec
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/spoolss.spec [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/spoolss.spec [iso-8859-1] Wed Jun 24 16:26:33 2015
@@ -96,7 +96,7 @@
@ stub LoadDriverFiletoConvertDevmode
@ stub LoadDriverWithVersion
@ stub LogWmiTraceEvent
-@ stub MarshallDownStructure
+@ stdcall MarshallDownStructure(ptr ptr long long)
@ stub MarshallDownStructuresArray
@ stub MarshallUpStructure
@ stub MarshallUpStructuresArray
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/tools.c
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/tools.c [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolss/tools.c [iso-8859-1] Wed Jun 24 16:26:33 2015
@@ -7,6 +7,56 @@
#include "precomp.h"
+
+/**
+ * @name MarshallDownStructure
+ *
+ * Prepare a structure for marshalling/serialization by replacing absolute pointer addresses in its fields by relative offsets.
+ *
+ * @param pStructure
+ * Pointer to the structure to operate on.
+ *
+ * @param pParameters
+ * Array of MARSHALL_DOWN_INFO elements containing information about the fields of the structure as well as how to modify them.
+ * See the documentation on MARSHALL_DOWN_INFO for more information.
+ * You have to indicate the end of the array by setting the dwOffset field to MAXDWORD.
+ *
+ * @param cbStructureSize
+ * Apparently, this is the size in bytes of the structure given through pStructure under Windows.
+ * This parameter is unused in my implementation.
+ *
+ * @param bSomeBoolean
+ * Unknown boolean value
+ *
+ * @return
+ * TRUE if the structure was successfully adjusted, FALSE otherwise.
+ */
+BOOL WINAPI
+MarshallDownStructure(PVOID pStructure, PMARSHALL_DOWN_INFO pParameters, DWORD cbStructureSize, BOOL bSomeBoolean)
+{
+ // Sanity checks
+ if (!pStructure || !pParameters)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ // Loop until we reach an element with offset set to MAXDWORD.
+ while (pParameters->dwOffset != MAXDWORD)
+ {
+ if (pParameters->bAdjustAddress)
+ {
+ // Apply the byte offset on pStructure. There must be a pointer at this position, whose address we're adjusting
+ // by subtracting the address of pStructure from it.
+ *((PULONG_PTR)((PBYTE)pStructure + pParameters->dwOffset)) -= (ULONG_PTR)pStructure;
+ }
+
+ // Advance to the next element description.
+ pParameters++;
+ }
+
+ return TRUE;
+}
/**
* @name PackStrings
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/include/spoolss.h
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/win32ss/printing/include/spoolss.h [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/win32ss/printing/include/spoolss.h [iso-8859-1] Wed Jun 24 16:26:33 2015
@@ -8,10 +8,22 @@
#ifndef _REACTOS_SPOOLSS_H
#define _REACTOS_SPOOLSS_H
+typedef struct _MARSHALL_DOWN_INFO
+{
+ DWORD dwOffset; /** Byte offset of this element within the structure or MAXDWORD to indicate the end of the array */
+ DWORD cbSize; /** Total size of this element in bytes under Windows. Unused here, I don't know what we need this number for. */
+ DWORD cbPerElementSize; /** If this element is a structure itself, this field gives the size in bytes of each element of the structure.
+ Otherwise, this is the same as cbTotalSize. E.g. for SYSTEMTIME, cbSize would be 16 and cbPerElementSize would be 2.
+ Unused here, I don't know what we need this number for. */
+ BOOL bAdjustAddress; /** TRUE if MarshallDownStructure shall adjust the address of this element, FALSE if it shall leave this element untouched. */
+}
+MARSHALL_DOWN_INFO, *PMARSHALL_DOWN_INFO;
+
PWSTR WINAPI AllocSplStr(PCWSTR pwszInput);
PVOID WINAPI DllAllocSplMem(DWORD dwBytes);
BOOL WINAPI DllFreeSplMem(PVOID pMem);
BOOL WINAPI DllFreeSplStr(PWSTR pwszString);
+BOOL WINAPI MarshallDownStructure(PVOID pStructure, PMARSHALL_DOWN_INFO pParameters, DWORD cbStructureSize, BOOL bSomeBoolean);
PBYTE WINAPI PackStrings(PCWSTR* pSource, PBYTE pDest, PDWORD DestOffsets, PBYTE pEnd);
PVOID WINAPI ReallocSplMem(PVOID pOldMem, DWORD cbOld, DWORD cbNew);
BOOL WINAPI ReallocSplStr(PWSTR* ppwszString, PCWSTR pwszInput);
Author: tfaber
Date: Wed Jun 24 10:31:50 2015
New Revision: 68250
URL: http://svn.reactos.org/svn/reactos?rev=68250&view=rev
Log:
[USBCCGP]
- Reset FunctionDescriptorCount to zero in USBCCGP_LegacyEnum since the function can be called multiple times
CORE-9226
Modified:
trunk/reactos/drivers/usb/usbccgp/function.c
Modified: trunk/reactos/drivers/usb/usbccgp/function.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/functi…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] Wed Jun 24 10:31:50 2015
@@ -639,11 +639,7 @@
//
// init function descriptors
//
- if (FDODeviceExtension->FunctionDescriptorCount != 0)
- {
- DPRINT1("USBCCGP_LegacyEnum called with FunctionDescriptorCount=%lu. Adding another %lu descriptors will probably overflow\n", FDODeviceExtension->FunctionDescriptorCount, FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces);
- ASSERT(FDODeviceExtension->FunctionDescriptorCount == 0);
- }
+ FDODeviceExtension->FunctionDescriptorCount = 0;
for (Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++)
{
// get interface descriptor
Author: cfinck
Date: Wed Jun 24 09:51:29 2015
New Revision: 68248
URL: http://svn.reactos.org/svn/reactos?rev=68248&view=rev
Log:
[SPOOLSV, WINSPOOL]
Local Communication between winspool.drv and spoolsv.exe happens using the ncalrpc protocol. The ncacn_np endpoint is only available when sharing a printer. It's then used for receiving a remote call from win32spl.dll.
Reference: http://www.hsc.fr/ressources/articles/win_net_srv/msrpc_spoolss.html
This fixes e.g. testing a _RpcOpenPrinter call from our winspool.drv to a local printer under Windows.
Modified:
branches/colins-printing-for-freedom/reactos/include/reactos/idl/winspool.idl
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcserver.c
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c
Modified: branches/colins-printing-for-freedom/reactos/include/reactos/idl/winspool.idl
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/include/reactos/idl/winspool.idl [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/include/reactos/idl/winspool.idl [iso-8859-1] Wed Jun 24 09:51:29 2015
@@ -841,7 +841,7 @@
[
uuid(12345678-1234-ABCD-EF00-0123456789AB),
version(1.0),
- endpoint("ncacn_np:[\\pipe\\spoolss]"),
+ endpoint("ncalrpc:[spoolss]", "ncacn_np:[\\pipe\\spoolss]"),
pointer_default(unique)
]
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcserver.c
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcserver.c [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcserver.c [iso-8859-1] Wed Jun 24 09:51:29 2015
@@ -8,11 +8,11 @@
#include "precomp.h"
DWORD WINAPI
-RpcThreadProc(LPVOID lpParameter)
+LrpcThreadProc(LPVOID lpParameter)
{
RPC_STATUS Status;
- Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\spoolss", NULL);
+ Status = RpcServerUseProtseqEpW(L"ncalrpc", 20, L"spoolss", NULL);
if (Status != RPC_S_OK)
{
ERR("RpcServerUseProtseqEpW failed with status %ld!\n", Status);
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c
URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/rea…
==============================================================================
--- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c [iso-8859-1] (original)
+++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c [iso-8859-1] Wed Jun 24 09:51:29 2015
@@ -15,7 +15,7 @@
RPC_STATUS Status;
// Get us a string binding handle from the supplied connection information
- Status = RpcStringBindingComposeW(NULL, L"ncacn_np", wszName, L"\\pipe\\spoolss", NULL, &wszStringBinding);
+ Status = RpcStringBindingComposeW(NULL, L"ncalrpc", wszName, L"spoolss", NULL, &wszStringBinding);
if (Status != RPC_S_OK)
{
ERR("RpcStringBindingComposeW failed with status %ld!\n", Status);