mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Add guid generator by Jonathon Wilson
svn path=/trunk/; revision=5742
This commit is contained in:
parent
74b969bb49
commit
c6066fbd1a
3 changed files with 145 additions and 0 deletions
23
rosapps/devutils/genguid/Makefile
Normal file
23
rosapps/devutils/genguid/Makefile
Normal file
|
@ -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
|
84
rosapps/devutils/genguid/genguid.c
Normal file
84
rosapps/devutils/genguid/genguid.c
Normal file
|
@ -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 <objbase.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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(<<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 2:
|
||||||
|
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 3:
|
||||||
|
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 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
38
rosapps/devutils/genguid/genguid.rc
Normal file
38
rosapps/devutils/genguid/genguid.rc
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <reactos/resource.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue