Add beginning of lpc docs
authorAlex Ionescu <aionescu@gmail.com>
Wed, 17 Aug 2005 07:07:43 +0000 (07:07 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Wed, 17 Aug 2005 07:07:43 +0000 (07:07 +0000)
svn path=/trunk/; revision=17421

reactos/media/doc/LPC.txt [new file with mode: 0644]

diff --git a/reactos/media/doc/LPC.txt b/reactos/media/doc/LPC.txt
new file mode 100644 (file)
index 0000000..6e191f8
--- /dev/null
@@ -0,0 +1,53 @@
+==============================================================\r
+=                                                            =\r
+=               NOTES FROM THE UNDERGROUND                   =\r
+=                                                            =\r
+==============================================================\r
+Below are some of Alex's notes on the mysterious LPC Subsystem\r
+\r
+=========================\r
+1. Sizes, sizes, sizes...\r
+=========================\r
+\r
+There are four imporant LPC Sizes to keep in mind. Try to understand them:\r
+\r
+/* \r
+ * This determines the absolute maximum message size (0x100 bytes). For\r
+ * larger values, use a section-backed message.\r
+ */\r
+#define PORT_MAXIMUM_MESSAGE_LENGTH 256\r
+\r
+/*\r
+ * This determines the maximum length of an LPC request. It is the largest\r
+ * amount of bytes that an LPC request can take. To calculate this, assume\r
+ * that this is a CONNECTION_REQUEST message, which includes the additionnal\r
+ * LPCP_CONNECTION_MESSAGE structure as well. Therefore, we add the kernel LPC,\r
+ * header, the maximum port size and the size of the connection request \r
+ * structure. This gives a value of 0x15C. However, one must note that NT\r
+ * allocates the Lookaside List using a 16-byte aligned value, making this\r
+ * number 0x160.\r
+ */\r
+#define LPCP_MAX_MESSAGE_SIZE   ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \\r
+                                         sizeof(LPCP_MESSAGE) + \\r
+                                         sizeof(LPCP_CONNECTION_MESSAGE), 16)\r
+\r
+/*\r
+ * Now, for an actual LPC Request size, we remove the kernel LPC header, which\r
+ * yields the size of the actual LPC Data that follows the Header, making this\r
+ * number 0x148.\r
+ */\r
+#define LPC_MAX_MESSAGE_LENGTH (LPCP_MAX_MESSAGE_SIZE - \\r
+                                FIELD_OFFSET(LPCP_MESSAGE, Request))\r
+\r
+/*\r
+ * Finally, we'll calculate the maximum size of the Connection Info, giving us\r
+ * 0x104\r
+ */\r
+#define LPC_MAX_DATA_LENGTH     (LPC_MAX_MESSAGE_LENGTH - \\r
+                                 sizeof(PORT_MESSAGE) - \\r
+                                 sizeof(LPCP_CONNECTION_MESSAGE))\r
+\r
+==========================\r
+2. Structures\r
+==========================\r
+SOON. TODO.
\ No newline at end of file