--- trunk/reactos/tools/rbuild/backend/msvc/genguid.cpp 2005-08-21 04:04:13 UTC (rev 17456)
+++ trunk/reactos/tools/rbuild/backend/msvc/genguid.cpp 2005-08-21 14:04:19 UTC (rev 17457)
@@ -0,0 +1,61 @@
+/*
+ * Based on the genguid utility for WINE and ReactOS
+ *
+ * Copyright 2003 Jonathan Wilson
+ * Copyright 2005 Steven Edwards
+ *
+ * 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>
+
+static HRESULT (*pCoInitialize)(PVOID);
+static void (*pCoUninitialize)(void);
+static HRESULT (*pCoCreateGuid)(GUID*);
+
+void gen_guid()
+{
+ GUID m_guid;
+ HRESULT result;
+ char *strfmt = "";
+ HMODULE olelib;
+
+ /* Load ole32. We will need it later on */
+ olelib = LoadLibraryA( "ole32.dll" );
+
+ if (olelib != NULL)
+ pCoInitialize = (HRESULT (*)(void*))GetProcAddress( olelib, "CoInitialize" );
+ pCoUninitialize = (void (*)())GetProcAddress( olelib, "CoUninitialize" );
+ pCoCreateGuid = (HRESULT (*)(GUID*))GetProcAddress( olelib, "CoCreateGuid" );
+
+ if (pCoInitialize(NULL) != S_OK)
+ {
+ printf("Unable to initalize OLE libraries\n");
+ }
+ result = pCoCreateGuid(&m_guid);
+ if (result != S_OK) {
+ printf("Unable to create GUID\n");
+ pCoUninitialize();
+ }
+ strfmt = "%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n";
+ 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]);
+ pCoUninitialize();
+}
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2005-08-21 04:04:13 UTC (rev 17456)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2005-08-21 14:04:19 UTC (rev 17457)
@@ -29,6 +29,8 @@
using namespace std;
+void gen_guid();
+
static class MSVCFactory : public Backend::Factory
{
public:
@@ -95,6 +97,8 @@
cout << "Done." << endl << endl;
cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;
+
+ gen_guid();
}
void MSVCBackend::ProcessModules()
--- trunk/reactos/tools/rbuild/rbuild.mak 2005-08-21 04:04:13 UTC (rev 17456)
+++ trunk/reactos/tools/rbuild/rbuild.mak 2005-08-21 14:04:19 UTC (rev 17457)
@@ -137,6 +137,7 @@
)
RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
+ genguid.cpp \
msvc.cpp \
)
@@ -348,6 +349,10 @@
$(ECHO_CC)
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+$(RBUILD_MSVC_INT_)genguid.o: $(RBUILD_MSVC_BASE_)genguid.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
+ $(ECHO_CC)
+ ${host_gpp} $(RBUILD_HOST_CFLAGS) -c $< -o $@
+
$(RBUILD_MSVC_INT_)msvc.o: $(RBUILD_MSVC_BASE_)msvc.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
$(ECHO_CC)
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@