added a genguid helper function based on genguid by Jon Wilson. Will be needed later on when building project files.

svn path=/trunk/; revision=17457
This commit is contained in:
Steven Edwards 2005-08-21 14:04:19 +00:00
parent b87887e917
commit d45951b413
3 changed files with 70 additions and 0 deletions

View file

@ -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();
}

View file

@ -29,6 +29,8 @@
using namespace std;
void gen_guid();
static class MSVCFactory : public Backend::Factory
{
public:
@ -95,6 +97,8 @@ void MSVCBackend::Process()
cout << "Done." << endl << endl;
cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;
gen_guid();
}
void MSVCBackend::ProcessModules()

View file

@ -137,6 +137,7 @@ RBUILD_BACKEND_DEVCPP_BASE_SOURCES = $(addprefix $(RBUILD_DEVCPP_BASE_), \
)
RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
genguid.cpp \
msvc.cpp \
)
@ -348,6 +349,10 @@ $(RBUILD_DEVCPP_INT_)devcpp.o: $(RBUILD_DEVCPP_BASE_)devcpp.cpp $(RBUILD_HEADERS
$(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 $@