Index: /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk	(revision 78085)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk	(revision 78086)
@@ -248,7 +248,7 @@
 	unpacker/unpack_shaders.c \
 	unpacker/unpack_framebuffer.c \
-	$(VBOX_PATH_CROGL_GENFILES)/unpack.c
+	$(VBOX_PATH_CROGL_GENFILES)/unpack.cpp
 VBoxOGLcrunpacker_CLEAN = \
-	$(VBOX_PATH_CROGL_GENFILES)/unpack.c \
+	$(VBOX_PATH_CROGL_GENFILES)/unpack.cpp \
 	$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h
 
@@ -256,5 +256,5 @@
 # Generate files for VBoxOGLcrunpacker.
 #
-$(VBOX_PATH_CROGL_GENFILES)/unpack.c: \
+$(VBOX_PATH_CROGL_GENFILES)/unpack.cpp: \
 		$(addprefix $(PATH_SUB_CURRENT)/unpacker/, unpack.py unpacker_special) \
 		$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h \
Index: /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py	(revision 78085)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py	(revision 78086)
@@ -172,9 +172,10 @@
     # Verify that the provided buffer length is what we expect.
     packet_length = apiutil.PacketLength( params )
-    print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
-    print("\t{");
-    print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
-    print("\t\treturn;");
-    print("\t}");
+    if packet_length > 0:
+        print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
+        print("\t{");
+        print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
+        print("\t\treturn;");
+        print("\t}");
 
     vector_func = apiutil.VectorFunction(func_name)
@@ -340,9 +341,10 @@
             # Verify that the provided buffer length is what we expect.
             packet_length = apiutil.PacketLength( params )
-            print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
-            print("\t{");
-            print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
-            print("\t\treturn;");
-            print("\t}");
+            if packet_length > 0:
+                print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
+                print("\t{");
+                print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
+                print("\t\treturn;");
+                print("\t}");
 
             MakeNormalCall( return_type, func_name, params, 8 )
Index: /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py	(revision 78085)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py	(revision 78086)
@@ -18,4 +18,8 @@
 #define UNPACK_EXTEND_H 1
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 """)
 
@@ -31,4 +35,8 @@
 
 print("""
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 """)
