From c6066fbd1aa084fdcf710c9282e0aea462cd20a0 Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Fri, 22 Aug 2003 07:26:41 +0000 Subject: [PATCH] Add guid generator by Jonathon Wilson svn path=/trunk/; revision=5742 --- rosapps/devutils/genguid/Makefile | 23 ++++++++ rosapps/devutils/genguid/genguid.c | 84 +++++++++++++++++++++++++++++ rosapps/devutils/genguid/genguid.rc | 38 +++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 rosapps/devutils/genguid/Makefile create mode 100644 rosapps/devutils/genguid/genguid.c create mode 100644 rosapps/devutils/genguid/genguid.rc diff --git a/rosapps/devutils/genguid/Makefile b/rosapps/devutils/genguid/Makefile new file mode 100644 index 00000000000..270b401d197 --- /dev/null +++ b/rosapps/devutils/genguid/Makefile @@ -0,0 +1,23 @@ +# $Id: Makefile,v 1.1 2003/08/22 07:26:41 sedwards Exp $ + +PATH_TO_TOP = ../../../reactos + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = genguid + +TARGET_CFLAGS = -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API + +TARGET_SDKLIBS = kernel32.a + +TARGET_GCCLIBS = ole32 uuid + +TARGET_OBJECTS = genguid.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF diff --git a/rosapps/devutils/genguid/genguid.c b/rosapps/devutils/genguid/genguid.c new file mode 100644 index 00000000000..518dc371a36 --- /dev/null +++ b/rosapps/devutils/genguid/genguid.c @@ -0,0 +1,84 @@ +/* + * genguid utility for WINE and ReactOS + * + * 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 +#include + +int main(int argc, char *argv[]) +{ + GUID m_guid; + m_guid = GUID_NULL; + int arg; + HRESULT result; + char *strfmt = ""; + if (argc < 2) { + printf("usage: %s n\n",argv[0]); + printf("n = format of output\n"); + printf("values are:\n"); + printf("1 = IMPLEMENT_OLECREATE defintion\n"); + printf("2 = DEFINE_GUID definition\n"); + printf("3 = static const GUID definition\n"); + printf("4 = registry format\n"); + printf("5 = uuidgen.exe format\n"); + return 1; + } + arg = atoi(argv[1]); + if ((arg > 5) || (arg <= 0)) { + 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; + } + switch (arg) { + case 1: + strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nIMPLEMENT_OLECREATE(<>, <>, \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 2: + strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nDEFINE_GUID(<>, \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 3: + strfmt = "// {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\nstatic const GUID <> = \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 4: + strfmt = "{%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\n"; + break; + case 5: + strfmt = "%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n"; + break; + } + 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; +} + + diff --git a/rosapps/devutils/genguid/genguid.rc b/rosapps/devutils/genguid/genguid.rc new file mode 100644 index 00000000000..262d452e291 --- /dev/null +++ b/rosapps/devutils/genguid/genguid.rc @@ -0,0 +1,38 @@ +#include +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "GUID Generator\0" + VALUE "FileVersion", RES_STR_PRODUCT_VERSION + VALUE "InternalName", "genguid\0" + VALUE "LegalCopyright", "Jonathon Wilson" + VALUE "OriginalFilename", "genguid.exe\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + -- 2.17.1