new utillity for wine, genguid

Jonathan Wilson jonwil at tpgi.com.au
Tue Jul 22 08:16:54 CDT 2003


ok, is this better?
Included as one big patch
Also, added blank line, changed coding to 4 spaces instead of tab
and, changed options to use what you suggested.

It doesnt match exactly with either guidgen.exe from microsoft or 
uuidgen.exe from microsoft (hence the name genguid) but it will generate 
GUIDs which is all that we need :)


-------------- next part --------------
Index: programs/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/Makefile.in,v
retrieving revision 1.39
diff -u -r1.39 Makefile.in
--- programs/Makefile.in	23 Jun 2003 19:51:21 -0000	1.39
+++ programs/Makefile.in	22 Jul 2003 13:14:25 -0000
@@ -10,6 +10,7 @@
 	cmdlgtst \
 	control \
 	expand \
+	genguid \
 	notepad \
 	osversioncheck \
 	progman \
@@ -41,6 +42,7 @@
 	clock \
 	control \
 	expand \
+	genguid \
 	notepad \
 	progman \
 	regedit \
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.167
diff -u -r1.167 configure.ac
--- configure.ac	21 Jul 2003 22:01:07 -0000	1.167
+++ configure.ac	22 Jul 2003 13:14:36 -0000
@@ -1530,6 +1530,7 @@
 programs/cmdlgtst/Makefile
 programs/control/Makefile
 programs/expand/Makefile
+programs/genguid/Makefile
 programs/notepad/Makefile
 programs/osversioncheck/Makefile
 programs/progman/Makefile
--- /dev/null	1970-01-01 08:00:00.000000000 +0800
+++ programs/genguid/genguid.c	2003-07-22 21:09:23.000000000 +0800
@@ -0,0 +1,85 @@
+/*
+ *  genguid utility for WINE
+ *
+ *  Copyright 2003 Jonathan Wilson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <objbase.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+    GUID m_guid;
+    m_guid = GUID_NULL;
+    char arg;
+    HRESULT result;
+    char *strfmt = "";
+    if (argc < 2) {
+        printf("usage: %s option\n",argv[0]);
+        printf("option = format of output\n");
+        printf("values are:\n");
+        printf("-O = IMPLEMENT_OLECREATE defintion\n");
+        printf("-D = DEFINE_GUID definition\n");
+        printf("-c = static const GUID definition\n");
+        printf("-r = registry format\n");
+        printf("-u = uuidgen.exe format\n");
+        return 1;
+    }
+    arg = argv[1][1];
+    switch (arg) 
+    {
+    case 'O':
+    strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nIMPLEMENT_OLECREATE(<<class>>, <<external_name>>, \r\n0x%lx, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\r\n";
+    break;
+    case 'D':
+    strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nDEFINE_GUID(<<name>>, \r\n0x%lx, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\r\n";
+    break;
+    case 'c':
+    strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nstatic const GUID <<name>> = \r\n{ 0x%lx, 0x%x, 0x%x, { 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x } };\r\n";
+    break;
+    case 'r':
+    strfmt = "{%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\n";
+    break;
+    case 'u':
+    strfmt = "%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n";
+    break;
+    default:
+    printf("Invalid Argument\n");
+    return 1;
+    }
+    if (CoInitialize(NULL) != S_OK)
+    {
+        printf("Unable to initalize OLE libraries\n");
+        return 1;
+    }
+    result = CoCreateGuid(&m_guid);
+    if (result != S_OK) 
+    {
+        printf("Unable to create GUID\n");
+        CoUninitialize();
+        return 1;
+    }
+    printf(strfmt,m_guid.Data1,m_guid.Data2,m_guid.Data3,m_guid.Data4[0],
+    m_guid.Data4[1],m_guid.Data4[2],m_guid.Data4[3],m_guid.Data4[4],m_guid.Data4[5],
+    m_guid.Data4[6],m_guid.Data4[7],m_guid.Data1,m_guid.Data2,m_guid.Data3,
+    m_guid.Data4[0],m_guid.Data4[1],m_guid.Data4[2],m_guid.Data4[3],m_guid.Data4[4],
+    m_guid.Data4[5],m_guid.Data4[6],m_guid.Data4[7]);
+    CoUninitialize();
+    return 0;
+}
+
--- /dev/null	1970-01-01 08:00:00.000000000 +0800
+++ programs/genguid/Makefile.in	2003-07-22 19:57:31.000000000 +0800
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = genguid.exe
+APPMODE   = cui
+IMPORTS   = ole32
+EXTRALIBS = $(LIBUUID)
+
+C_SRCS = genguid.c
+
+ at MAKE_PROG_RULES@
+
+### Dependencies:
--- /dev/null	1970-01-01 08:00:00.000000000 +0800
+++ programs/genguid/.cvsignore	2003-07-22 18:57:47.000000000 +0800
@@ -0,0 +1,3 @@
+Makefile
+genguid.exe.dbg.c
+genguid.exe.spec.c


More information about the wine-patches mailing list