--- /dev/null
+//---------------------------------------------------------------------------
+
+#include <windows.h>
+#include <stdio.h>
+#include <shellapi.h>
+#include <shlobj.h>
+#include <string>
+#include <string.h>
+#include <iostream>
+#include <fstream>
+
+
+using namespace std;
+
+
+
+#pragma hdrstop
+
+//---------------------------------------------------------------------------
+
+
+/*
+ To have fontconfig work right , it requires some config files located at \\etc\\fonts\\ of
+ where fc functions are called .We also need to insert windows font directory to fc config file
+*/
+
+int fix_fontconfig()
+{
+ char B[1024];
+ string FontFolder="";
+ string fcConfigFile="";
+ string BB="";
+ //retrieve font directory
+ ::SHGetSpecialFolderPath( NULL,B , CSIDL_FONTS , 0 );
+ //check if directory already exists
+
+ //retrieve current directory
+ TCHAR curWorkingDir[2024];
+ GetCurrentDirectory(2024,curWorkingDir);
+ //set fc config file
+ fcConfigFile.append(curWorkingDir);
+ fcConfigFile.append("\\etc\\fonts\\fonts.conf");
+ cout << fcConfigFile;
+
+ ifstream file (fcConfigFile.c_str(),ios::in);
+ if (file)
+ {
+ while (!file.eof())
+ {
+ BB.push_back(file.get());
+ }
+ file.close();
+ // cout << BB;
+ // cout << "\n" <<"position of found text:" <<BB.find("#WINDOWSFONTDIR#",0 );
+ size_t a=BB.find("#WINDOWSFONTDIR#",0 );
+ if (a !=string::npos)
+ BB.replace ( a , strlen(B),B );
+ std::ofstream out(fcConfigFile.c_str());
+ out<< BB <<'\n';
+ out.close();
+ }
+ return 0;
+}
+
+
+int add_to_path(string path)
+{
+
+ string Path="";
+ string graphvizfolder="";
+ HKEY hKey = 0;
+ char buf[1024] = {0};
+ DWORD dwType = 0;
+ DWORD dwBufSize = sizeof(buf);
+
+ const char* subkey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
+ if( RegOpenKeyEx(HKEY_LOCAL_MACHINE,subkey,0, KEY_ALL_ACCESS,&hKey) == ERROR_SUCCESS)
+ {
+ dwType = REG_EXPAND_SZ;
+ if( RegQueryValueEx(hKey,"Path",0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)
+ {
+ TCHAR curWorkingDir[2024];
+ GetCurrentDirectory(2024,curWorkingDir);
+// cout << "key value is '" << buf << "'\n";
+ graphvizfolder.append(curWorkingDir);
+ graphvizfolder.append("\\bin");
+ Path.append(buf);
+ if (Path.find(graphvizfolder.c_str(),0 )== string::npos)
+ {
+ Path.append(";");
+ Path.append(curWorkingDir);
+ Path.append("\\bin;");
+ RegSetValueEx (hKey, "Path", 0L, dwType, (BYTE*)Path.c_str(), (DWORD)strlen(Path.c_str())+ 1 );
+ //[this block is to inform system about path change, so to avoid restart
+ DWORD dwReturnValue;
+ SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE,
+ 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
+
+ }
+ }
+ RegCloseKey(hKey);
+ }
+ return 0;
+}
+
+
+
+
+
+
+int main(int argc, char* argv[])
+{
+ /*this little utility is called right after graphviz is intalled by msi package
+ its job is to finalize installation by modifing few things.
+ */
+ add_to_path("");
+ fix_fontconfig();
+ return 0;
+}
+//---------------------------------------------------------------------------
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fc-fix", "fc-fix.vcproj", "{0DEA6915-263C-4570-B25C-E0A449894D45}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0DEA6915-263C-4570-B25C-E0A449894D45}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0DEA6915-263C-4570-B25C-E0A449894D45}.Debug|Win32.Build.0 = Debug|Win32
+ {0DEA6915-263C-4570-B25C-E0A449894D45}.Release|Win32.ActiveCfg = Release|Win32
+ {0DEA6915-263C-4570-B25C-E0A449894D45}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="fc-fix"
+ ProjectGUID="{0DEA6915-263C-4570-B25C-E0A449894D45}"
+ RootNamespace="fc-fix"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\fc-fix.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>