[WIN32CSR]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 20 Feb 2011 19:23:46 +0000 (19:23 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 20 Feb 2011 19:23:46 +0000 (19:23 +0000)
Add a new API GetTempFile() that returns an identifier to be used for creating temporary files.
This API should be in basesrv.dll

svn path=/trunk/; revision=50835

reactos/include/reactos/subsys/csrss/csrss.h
reactos/subsystems/win32/csrss/win32csr/dllmain.c
reactos/subsystems/win32/csrss/win32csr/file.c [new file with mode: 0644]
reactos/subsystems/win32/csrss/win32csr/file.h [new file with mode: 0644]
reactos/subsystems/win32/csrss/win32csr/w32csr.h
reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild

index 1156d39..47c5add 100644 (file)
@@ -511,7 +511,12 @@ typedef struct
   DWORD NumberOfHistoryBuffers;
   DWORD dwFlags;
 } CSRSS_GET_HISTORY_INFO, *PCSRSS_GET_HISTORY_INFO,
-  CSRSS_SET_HISTORY_INFO, *PCSRSS_SET_HISTORY_INFO;
+  CSRSS_SET_HISTORY_INFO, *PCSRSS_SET_HISTORY_INFO;;
+
+typedef struct
+{
+  UINT UniqueID;
+} CSRSS_GET_TEMP_FILE, *PCSRSS_GET_TEMP_FILE;
 
 #define CSR_API_MESSAGE_HEADER_SIZE(Type)       (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type))
 #define CSRSS_MAX_WRITE_CONSOLE                 (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE))
@@ -592,6 +597,7 @@ typedef struct
 #define SET_HISTORY_NUMBER_COMMANDS   (0x45)
 #define GET_HISTORY_INFO              (0x46)
 #define SET_HISTORY_INFO              (0x47)
+#define GET_TEMP_FILE                 (0x48)
 
 /* Keep in sync with definition below. */
 #define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
@@ -673,6 +679,7 @@ typedef struct _CSR_API_MESSAGE
         CSRSS_SET_HISTORY_NUMBER_COMMANDS SetHistoryNumberCommands;
         CSRSS_GET_HISTORY_INFO GetHistoryInfo;
         CSRSS_SET_HISTORY_INFO SetHistoryInfo;
+        CSRSS_GET_TEMP_FILE GetTempFile;
     } Data;
 } CSR_API_MESSAGE, *PCSR_API_MESSAGE;
 
index f385588..06112ab 100644 (file)
@@ -87,6 +87,7 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
     CSRSS_DEFINE_API(SET_HISTORY_NUMBER_COMMANDS,  CsrSetHistoryNumberCommands),
     CSRSS_DEFINE_API(GET_HISTORY_INFO,             CsrGetHistoryInfo),
     CSRSS_DEFINE_API(SET_HISTORY_INFO,             CsrSetHistoryInfo),
+    CSRSS_DEFINE_API(GET_TEMP_FILE,                CsrGetTempFile),
     { 0, 0, NULL }
 };
 
diff --git a/reactos/subsystems/win32/csrss/win32csr/file.c b/reactos/subsystems/win32/csrss/win32csr/file.c
new file mode 100644 (file)
index 0000000..fd36621
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS system libraries
+ * FILE:            subsys/csrss/win32csr/file.c
+ * PURPOSE:         File handling
+ * PROGRAMMERS:     Pierre Schweitzer (pierre.schweitzer@reactos.org)
+ * NOTE:            Belongs to basesrv.dll
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <w32csr.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS *******************************************************************/
+
+UINT CsrGetTempFileUnique;
+
+/* FUNCTIONS *****************************************************************/
+
+CSR_API(CsrGetTempFile)
+{
+    DPRINT1("CsrGetTempFile entered\n");
+
+    /* Return 16-bits ID */
+    Request->Data.GetTempFile.UniqueID = (++CsrGetTempFileUnique & 0xFFFF);
+
+    DPRINT1("Returning: %u\n", Request->Data.GetTempFile.UniqueID);
+
+    return STATUS_SUCCESS;
+}
diff --git a/reactos/subsystems/win32/csrss/win32csr/file.h b/reactos/subsystems/win32/csrss/win32csr/file.h
new file mode 100644 (file)
index 0000000..c163ee5
--- /dev/null
@@ -0,0 +1,17 @@
+/* 
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS system libraries
+ * FILE:            subsystem/win32/csrss/win32csr/file.h
+ * PURPOSE:         File handling
+ * PROGRAMMERS:     Pierre Schweitzer (pierre.schweitzer@reactos.org)
+ * NOTE:            Belongs to basesrv.dll
+ */
+
+#pragma once
+
+#include "api.h"
+
+/* Api functions */
+CSR_API(CsrGetTempFile);
+
+/* EOF */
index 5ecc378..8516ccc 100644 (file)
@@ -18,6 +18,7 @@
 #include <conio.h>
 #include <csrplugin.h>
 #include <desktopbg.h>
+#include "file.h"
 #include "guiconsole.h"
 #include "tuiconsole.h"
 #include <win32csr.h>
index 0764763..d81443b 100644 (file)
@@ -24,6 +24,7 @@
        <file>desktopbg.c</file>
        <file>dllmain.c</file>
        <file>exitros.c</file>
+       <file>file.c</file>
        <file>guiconsole.c</file>
        <file>handle.c</file>
        <file>harderror.c</file>