DXGL r562 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r561‎ | r562 | r563 >
Date:02:19, 10 November 2014
Author:admin
Status:new
Tags:
Comment:
Create experimental DXGLCFG project.
Update copyright date on installer.
Modified paths:
  • /Installer/dxgl.nsi (modified) (history)
  • /dxgl.sln (modified) (history)
  • /dxglcfg2 (added) (history)
  • /dxglcfg2/dxglcfg2.c (added) (history)
  • /dxglcfg2/dxglcfg2.rc (added) (history)
  • /dxglcfg2/dxglcfg2.vcxproj (added) (history)
  • /dxglcfg2/dxglcfg2.vcxproj.filters (added) (history)
  • /dxglcfg2/resource.h (added) (history)
  • /dxglcfg2/xp.manifest (added) (history)

Diff [purge]

Index: Installer/dxgl.nsi
——@@ -84,7 +84,7 @@
8585 VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "DXGL ${PRODUCT_VERSION} Installer"
8686 VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}"
8787 VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "DXGL"
88 -VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright © 2011-2012 William Feely"
 88+VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright © 2011-2014 William Feely"
8989 VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "DXGL-${PRODUCT_VERSION}-win32.exe"
9090 VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "DXGL"
9191 VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${PRODUCT_VERSION}"
Index: dxgl.sln
——@@ -1,6 +1,8 @@
22 
3 -Microsoft Visual Studio Solution File, Format Version 11.00
4 -# Visual C++ Express 2010
 3+Microsoft Visual Studio Solution File, Format Version 12.00
 4+# Visual Studio Express 2013 for Windows Desktop
 5+VisualStudioVersion = 12.0.30723.0
 6+MinimumVisualStudioVersion = 10.0.40219.1
57 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ddraw", "ddraw\ddraw.vcxproj", "{9F051466-EA2C-4195-80B1-1B7C5B3F4AC2}"
68 ProjectSection(ProjectDependencies) = postProject
79 {55A95F84-E00E-4C65-BB09-41D27C5845AC} = {55A95F84-E00E-4C65-BB09-41D27C5845AC}
——@@ -46,6 +48,8 @@
4749 EndProject
4850 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minilibc", "minilibc\minilibc.vcxproj", "{F88980E4-C887-4046-A826-B1D81FAE67DC}"
4951 EndProject
 52+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxglcfg2", "dxglcfg2\dxglcfg2.vcxproj", "{C59AC409-F7D0-4153-9874-184CA00D537B}"
 53+EndProject
5054 Global
5155 GlobalSection(SolutionConfigurationPlatforms) = preSolution
5256 Debug no DXGL|Win32 = Debug no DXGL|Win32
——@@ -159,6 +163,18 @@
160164 {F88980E4-C887-4046-A826-B1D81FAE67DC}.Debug|Win32.ActiveCfg = Debug|Win32
161165 {F88980E4-C887-4046-A826-B1D81FAE67DC}.Release no DXGL|Win32.ActiveCfg = Release|Win32
162166 {F88980E4-C887-4046-A826-B1D81FAE67DC}.Release|Win32.ActiveCfg = Release|Win32
 167+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug no DXGL|Win32.ActiveCfg = Debug no DXGL|Win32
 168+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug no DXGL|Win32.Build.0 = Debug no DXGL|Win32
 169+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug No MSVCRT|Win32.ActiveCfg = Debug No MSVCRT|Win32
 170+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug No MSVCRT|Win32.Build.0 = Debug No MSVCRT|Win32
 171+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug Trace|Win32.ActiveCfg = Debug No MSVCRT|Win32
 172+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug Trace|Win32.Build.0 = Debug No MSVCRT|Win32
 173+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug|Win32.ActiveCfg = Debug|Win32
 174+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Debug|Win32.Build.0 = Debug|Win32
 175+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Release no DXGL|Win32.ActiveCfg = Release no DXGL|Win32
 176+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Release no DXGL|Win32.Build.0 = Release no DXGL|Win32
 177+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Release|Win32.ActiveCfg = Release|Win32
 178+ {C59AC409-F7D0-4153-9874-184CA00D537B}.Release|Win32.Build.0 = Release|Win32
163179 EndGlobalSection
164180 GlobalSection(SolutionProperties) = preSolution
165181 HideSolutionNode = FALSE
Index: dxglcfg2/dxglcfg2.c
——@@ -0,0 +1,1307 @@
 2+// DXGL
 3+// Copyright (C) 2011-2014 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#define _WIN32_WINNT 0x0600
 20+#define _WIN32_IE 0x0300
 21+#define _CRT_SECURE_NO_WARNINGS
 22+#define _CRTDBG_MAP_ALLOC
 23+#include <stdlib.h>
 24+#include <crtdbg.h>
 25+#include <windows.h>
 26+#include <HtmlHelp.h>
 27+#include <CommCtrl.h>
 28+#include <string.h>
 29+#include <tchar.h>
 30+#include <stdio.h>
 31+#include <math.h>
 32+#include <io.h>
 33+#include "resource.h"
 34+#include "../cfgmgr/cfgmgr.h"
 35+#include <gl/GL.h>
 36+
 37+#ifndef SHGFI_ADDOVERLAYS
 38+#define SHGFI_ADDOVERLAYS 0x000000020
 39+#endif //SHGFI_ADDOVERLAYS
 40+
 41+#ifndef BCM_SETSHIELD
 42+#define BCM_SETSHIELD 0x160C
 43+#endif
 44+
 45+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
 46+#define GL_MAX_SAMPLES_EXT 0x8D57
 47+#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
 48+#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
 49+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
 50+
 51+DXGLCFG *cfg;
 52+DXGLCFG *cfgmask;
 53+BOOL *dirty;
 54+HINSTANCE hinstance;
 55+BOOL msaa = FALSE;
 56+const char *extensions_string = NULL;
 57+OSVERSIONINFO osver;
 58+TCHAR hlppath[MAX_PATH+16];
 59+
 60+typedef struct
 61+{
 62+ LPTSTR regkey;
 63+ LPTSTR name;
 64+ HICON icon;
 65+ BOOL icon_shared;
 66+ BOOL dirty;
 67+ DXGLCFG cfg;
 68+ DXGLCFG mask;
 69+} app_setting;
 70+
 71+TCHAR exe_filter[] = _T("Program Files\0*.exe\0All Files\0*.*\0\0");
 72+
 73+app_setting *apps;
 74+int appcount;
 75+int maxapps;
 76+DWORD current_app;
 77+BOOL tristate;
 78+TCHAR strdefault[] = _T("(global default)");
 79+
 80+DWORD AddApp(LPCTSTR path, BOOL copyfile, BOOL admin)
 81+{
 82+ BOOL installed = FALSE;
 83+ BOOL dxgl_installdir = FALSE;
 84+ BOOL old_dxgl = FALSE;
 85+ TCHAR command[MAX_PATH+32];
 86+ SHELLEXECUTEINFO shex;
 87+ DWORD exitcode;
 88+ if (copyfile)
 89+ {
 90+ DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
 91+ TCHAR installpath[MAX_PATH+1];
 92+ TCHAR srcpath[MAX_PATH+1];
 93+ TCHAR destpath[MAX_PATH+1];
 94+ HKEY hKeyInstall;
 95+ LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
 96+ if(error == ERROR_SUCCESS)
 97+ {
 98+ dxgl_installdir = TRUE;
 99+ error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
 100+ if(error == ERROR_SUCCESS) installed = TRUE;
 101+ }
 102+ if(hKeyInstall) RegCloseKey(hKeyInstall);
 103+ if(!installed)
 104+ {
 105+ GetModuleFileName(NULL,installpath,MAX_PATH+1);
 106+ }
 107+ if(dxgl_installdir) _tcscat(installpath,_T("\\"));
 108+ else (_tcsrchr(installpath,_T('\\')))[1] = 0;
 109+ _tcsncpy(srcpath,installpath,MAX_PATH+1);
 110+ _tcscat(srcpath,_T("ddraw.dll"));
 111+ _tcsncpy(destpath,path,MAX_PATH+1);
 112+ (_tcsrchr(destpath,_T('\\')))[1] = 0;
 113+ _tcscat(destpath,_T("ddraw.dll"));
 114+ error = CopyFile(srcpath,destpath,TRUE);
 115+ error_loop:
 116+ if(!error)
 117+ {
 118+ error = GetLastError();
 119+ if(error == ERROR_FILE_EXISTS)
 120+ {
 121+ HMODULE hmod = LoadLibrary(destpath);
 122+ if(hmod)
 123+ {
 124+ if(GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = TRUE;
 125+ FreeLibrary(hmod);
 126+ }
 127+ if(old_dxgl)
 128+ {
 129+ error = CopyFile(srcpath,destpath,FALSE);
 130+ goto error_loop;
 131+ }
 132+ }
 133+ if((error == ERROR_ACCESS_DENIED) && !admin)
 134+ {
 135+ _tcscpy(command,_T(" install "));
 136+ _tcscat(command,path);
 137+ ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
 138+ shex.cbSize = sizeof(SHELLEXECUTEINFO);
 139+ shex.lpVerb = _T("runas");
 140+ shex.fMask = SEE_MASK_NOCLOSEPROCESS;
 141+ _tcscat(installpath,_T("\\dxglcfg.exe"));
 142+ shex.lpFile = installpath;
 143+ shex.lpParameters = command;
 144+ ShellExecuteEx(&shex);
 145+ WaitForSingleObject(shex.hProcess,INFINITE);
 146+ GetExitCodeProcess(shex.hProcess,&exitcode);
 147+ return exitcode;
 148+ }
 149+ return error;
 150+ }
 151+ }
 152+ return 0;
 153+}
 154+
 155+DWORD DelApp(LPCTSTR path, BOOL admin)
 156+{
 157+ BOOL installed = FALSE;
 158+ TCHAR command[MAX_PATH + 32];
 159+ BOOL old_dxgl = TRUE;
 160+ DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
 161+ TCHAR installpath[MAX_PATH+1];
 162+ HKEY hKeyInstall;
 163+ HMODULE hmod;
 164+ SHELLEXECUTEINFO shex;
 165+ DWORD exitcode;
 166+ LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\DXGL"), 0, KEY_READ, &hKeyInstall);
 167+ if(error == ERROR_SUCCESS)
 168+ {
 169+ error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
 170+ if(error == ERROR_SUCCESS) installed = TRUE;
 171+ }
 172+ if(hKeyInstall) RegCloseKey(hKeyInstall);
 173+ if(!installed)
 174+ {
 175+ GetModuleFileName(NULL,installpath,MAX_PATH+1);
 176+ }
 177+ hmod = LoadLibrary(path);
 178+ if(hmod)
 179+ {
 180+ if(!GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = FALSE;
 181+ FreeLibrary(hmod);
 182+ }
 183+ if(!old_dxgl) return 0;
 184+ if(!DeleteFile(path))
 185+ {
 186+ error = GetLastError();
 187+ if(error == ERROR_FILE_NOT_FOUND) return 0;
 188+ if((error == ERROR_ACCESS_DENIED) && !admin)
 189+ {
 190+ _tcscpy(command,_T(" remove "));
 191+ _tcscat(command,path);
 192+ ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
 193+ shex.cbSize = sizeof(SHELLEXECUTEINFO);
 194+ shex.lpVerb = _T("runas");
 195+ shex.fMask = SEE_MASK_NOCLOSEPROCESS;
 196+ _tcscat(installpath,_T("\\dxglcfg.exe"));
 197+ shex.lpFile = installpath;
 198+ shex.lpParameters = command;
 199+ ShellExecuteEx(&shex);
 200+ WaitForSingleObject(shex.hProcess,INFINITE);
 201+ GetExitCodeProcess(shex.hProcess,&exitcode);
 202+ return exitcode;
 203+ }
 204+ return error;
 205+ }
 206+ return 0;
 207+}
 208+
 209+void SaveChanges(HWND hWnd)
 210+{
 211+ int i;
 212+ if(apps[0].dirty) SetGlobalConfig(&apps[0].cfg);
 213+ for(i = 1; i < appcount; i++)
 214+ {
 215+ if(apps[i].dirty) SetConfig(&apps[i].cfg,&apps[i].mask,apps[i].regkey);
 216+ }
 217+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),FALSE);
 218+}
 219+
 220+void FloatToAspect(float f, LPTSTR aspect)
 221+{
 222+ float integer;
 223+ float dummy;
 224+ float fract;
 225+ TCHAR denominator[5];
 226+ int i;
 227+ if (f >= 1000.0f) // Clamp ridiculously wide aspects
 228+ {
 229+ _tcscpy(aspect, _T("1000:1"));
 230+ return;
 231+ }
 232+ if (f < 0.001f) // Exclude ridiculously tall aspects, zero, and negative
 233+ {
 234+ _tcscpy(aspect, _T("Default"));
 235+ return;
 236+ }
 237+ // Handle common aspects
 238+ if (fabsf(f - 1.25f) < 0.0001f)
 239+ {
 240+ _tcscpy(aspect, _T("5:4"));
 241+ return;
 242+ }
 243+ if (fabsf(f - 1.3333333f) < 0.0001f)
 244+ {
 245+ _tcscpy(aspect, _T("4:3"));
 246+ return;
 247+ }
 248+ if (fabsf(f - 1.6f) < 0.0001f)
 249+ {
 250+ _tcscpy(aspect, _T("16:10"));
 251+ return;
 252+ }
 253+ if (fabsf(f - 1.7777777) < 0.0001f)
 254+ {
 255+ _tcscpy(aspect, _T("16:9"));
 256+ return;
 257+ }
 258+ if (fabsf(f - 1.9333333) < 0.0001f)
 259+ {
 260+ _tcscpy(aspect, _T("256:135"));
 261+ return;
 262+ }
 263+ fract = modff(f, &integer);
 264+ if (fract < 0.0001f) //Handle integer aspects
 265+ {
 266+ _itot((int)integer, aspect, 10);
 267+ _tcscat(aspect, _T(":1"));
 268+ return;
 269+ }
 270+ // Finally try from 2 to 1000
 271+ for (i = 2; i < 1000; i++)
 272+ {
 273+ if (fabsf(modff(fract*i, &dummy)) < 0.0001f)
 274+ {
 275+ _itot((f*i) + .5f, aspect, 10);
 276+ _itot(i, denominator, 10);
 277+ _tcscat(aspect, _T(":"));
 278+ _tcscat(aspect, denominator);
 279+ return;
 280+ }
 281+ }
 282+ // Cannot find a reasonable fractional aspect, so display as decimal.
 283+#ifdef _UNICODE
 284+ swprintf(aspect, 31, L"%.6f", f);
 285+#else
 286+ sprintf(aspect,"%.6f", f);
 287+#endif
 288+
 289+}
 290+
 291+void SetCheck(HWND hWnd, int DlgItem, BOOL value, BOOL mask, BOOL tristate)
 292+{
 293+ if(tristate && !mask)
 294+ SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_INDETERMINATE,0);
 295+ else
 296+ {
 297+ if(value) SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_CHECKED,0);
 298+ else SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_UNCHECKED,0);
 299+ }
 300+}
 301+
 302+void SetCombo(HWND hWnd, int DlgItem, DWORD value, DWORD mask, BOOL tristate)
 303+{
 304+ if(tristate && !mask)
 305+ SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
 306+ SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 307+ else
 308+ SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,value,0);
 309+}
 310+
 311+void SetAspectCombo(HWND hWnd, int DlgItem, float value, DWORD mask, BOOL tristate)
 312+{
 313+ TCHAR buffer[32];
 314+ if (tristate && !mask)
 315+ SendDlgItemMessage(hWnd, DlgItem, CB_SETCURSEL,
 316+ SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 317+ else
 318+ {
 319+ FloatToAspect(value, buffer);
 320+ SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
 321+ SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)buffer), 0);
 322+ SetDlgItemText(hWnd, DlgItem, buffer);
 323+ }
 324+
 325+}
 326+
 327+void SetText(HWND hWnd, int DlgItem, TCHAR *value, TCHAR *mask, BOOL tristate)
 328+{
 329+ if(tristate && (mask[0] == 0))
 330+ SetWindowText(GetDlgItem(hWnd,DlgItem),_T(""));
 331+ else SetWindowText(GetDlgItem(hWnd,DlgItem),value);
 332+}
 333+
 334+BOOL GetCheck(HWND hWnd, int DlgItem, BOOL *mask)
 335+{
 336+ int check = SendDlgItemMessage(hWnd,DlgItem,BM_GETCHECK,0,0);
 337+ switch(check)
 338+ {
 339+ case BST_CHECKED:
 340+ *mask = TRUE;
 341+ return TRUE;
 342+ case BST_UNCHECKED:
 343+ *mask = TRUE;
 344+ return FALSE;
 345+ case BST_INDETERMINATE:
 346+ default:
 347+ *mask = FALSE;
 348+ return FALSE;
 349+ }
 350+}
 351+
 352+DWORD GetCombo(HWND hWnd, int DlgItem, DWORD *mask)
 353+{
 354+ int value = SendDlgItemMessage(hWnd,DlgItem,CB_GETCURSEL,0,0);
 355+ if(value == SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault))
 356+ {
 357+ *mask = 0;
 358+ return 0;
 359+ }
 360+ else
 361+ {
 362+ *mask = 1;
 363+ return value;
 364+ }
 365+}
 366+
 367+float GetAspectCombo(HWND hWnd, int DlgItem, float *mask)
 368+{
 369+ TCHAR buffer[32];
 370+ TCHAR *ptr;
 371+ float numerator, denominator;
 372+ GetDlgItemText(hWnd, DlgItem, buffer, 31);
 373+ if (!_tcscmp(buffer, strdefault))
 374+ {
 375+ *mask = 0.0f;
 376+ return 0;
 377+ }
 378+ else
 379+ {
 380+ *mask = 1.0f;
 381+ if (!_tcscmp(buffer, _T("Default"))) return 0.0f;
 382+ else
 383+ {
 384+ // Check for colon
 385+ ptr = _tcsstr(buffer, _T(":"));
 386+ if (ptr)
 387+ {
 388+ *ptr = 0;
 389+ numerator = _ttof(buffer);
 390+ denominator = _ttof(ptr + 1);
 391+ return numerator / denominator;
 392+ }
 393+ else return _ttof(buffer);
 394+ }
 395+ }
 396+}
 397+
 398+void GetText(HWND hWnd, int DlgItem, TCHAR *str, TCHAR *mask)
 399+{
 400+ GetDlgItemText(hWnd,DlgItem,str,MAX_PATH+1);
 401+ if(str[0] == 0) mask[0] = 0;
 402+ else mask[0] = 0xff;
 403+}
 404+
 405+LRESULT CALLBACK DXGLCfgCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 406+{
 407+ PIXELFORMATDESCRIPTOR pfd =
 408+ {
 409+ sizeof(PIXELFORMATDESCRIPTOR),
 410+ 1,
 411+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags
 412+ PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette.
 413+ 0, //Colordepth of the framebuffer.
 414+ 0, 0, 0, 0, 0, 0,
 415+ 0,
 416+ 0,
 417+ 0,
 418+ 0, 0, 0, 0,
 419+ 24, //Number of bits for the depthbuffer
 420+ 8, //Number of bits for the stencilbuffer
 421+ 0, //Number of Aux buffers in the framebuffer.
 422+ PFD_MAIN_PLANE,
 423+ 0,
 424+ 0, 0, 0
 425+ };
 426+ GLfloat anisotropic;
 427+ HDC dc;
 428+ HGLRC rc;
 429+ GLint maxsamples;
 430+ GLint maxcoverage = 0;
 431+ GLint coveragemodes[64];
 432+ int msaamodes[32];
 433+ int pf;
 434+ int i;
 435+ HKEY hKeyBase;
 436+ HKEY hKey;
 437+ DWORD keysize,keysize2;
 438+ DEVMODE mode;
 439+ LPTSTR keyname;
 440+ LPTSTR regbuffer;
 441+ DWORD regbuffersize;
 442+ DWORD regbufferpos;
 443+ DWORD buffersize;
 444+ LONG error;
 445+ TCHAR buffer[64];
 446+ TCHAR subkey[MAX_PATH];
 447+ LPTSTR path;
 448+ SHFILEINFO fileinfo;
 449+ DWORD verinfosize;
 450+ LPTSTR outbuffer;
 451+ UINT outlen;
 452+ TCHAR verpath[64];
 453+ WORD translation[2];
 454+ DWORD cursel;
 455+ DRAWITEMSTRUCT* drawitem = (DRAWITEMSTRUCT*)lParam;
 456+ BOOL hasname;
 457+ void *verinfo;
 458+ COLORREF OldTextColor,OldBackColor;
 459+ HANDLE token = NULL;
 460+ TOKEN_ELEVATION elevation;
 461+ HWND hGLWnd;
 462+ OPENFILENAME filename;
 463+ TCHAR selectedfile[MAX_PATH + 1];
 464+ LPTSTR regpath;
 465+ LPTSTR regkey;
 466+ BOOL failed;
 467+ switch (Msg)
 468+ {
 469+ case WM_INITDIALOG:
 470+ tristate = FALSE;
 471+ maxapps = 128;
 472+ apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
 473+ apps[0].name = (TCHAR*)malloc(7 * sizeof(TCHAR));
 474+ _tcscpy(apps[0].name,_T("Global"));
 475+ apps[0].regkey = (TCHAR*)malloc(7 * sizeof(TCHAR));
 476+ _tcscpy(apps[0].regkey,_T("Global"));
 477+ GetGlobalConfig(&apps[0].cfg, FALSE);
 478+ cfg = &apps[0].cfg;
 479+ cfgmask = &apps[0].mask;
 480+ dirty = &apps[0].dirty;
 481+ memset(&apps[0].mask,0xff,sizeof(DXGLCFG));
 482+ apps[0].dirty = FALSE;
 483+ apps[0].icon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_STAR));
 484+ apps[0].icon_shared = TRUE;
 485+ SetClassLong(hWnd,GCL_HICON,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGL));
 486+ SetClassLong(hWnd,GCL_HICONSM,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGLSM));
 487+ // create temporary gl context to get AA and AF settings.
 488+ mode.dmSize = sizeof(DEVMODE);
 489+ EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&mode);
 490+ pfd.cColorBits = (BYTE)mode.dmBitsPerPel;
 491+ hGLWnd = CreateWindow(_T("STATIC"),NULL,WS_CHILD,0,0,16,16,hWnd,NULL,NULL,NULL);
 492+ dc = GetDC(hGLWnd);
 493+ pf = ChoosePixelFormat(dc,&pfd);
 494+ SetPixelFormat(dc,pf,&pfd);
 495+ rc = wglCreateContext(dc);
 496+ wglMakeCurrent(dc,rc);
 497+ extensions_string = (char*)glGetString(GL_EXTENSIONS);
 498+ if(strstr(extensions_string,"GL_EXT_texture_filter_anisotropic"))
 499+ glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&anisotropic);
 500+ else anisotropic = 0;
 501+ if(strstr(extensions_string,"GL_EXT_framebuffer_multisample"))
 502+ {
 503+ glGetIntegerv(GL_MAX_SAMPLES_EXT,&maxsamples);
 504+ if(strstr(extensions_string,"GL_NV_framebuffer_multisample_coverage")) // Supports NVIDIA CSAA
 505+ {
 506+ glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV,&maxcoverage);
 507+ glGetIntegerv(GL_MULTISAMPLE_COVERAGE_MODES_NV,coveragemodes);
 508+ if(maxcoverage) for(i = 0; i < maxcoverage; i++)
 509+ {
 510+ msaamodes[i] = coveragemodes[2*i]+(4096*coveragemodes[(2*i)+1]);
 511+ msaa = TRUE;
 512+ }
 513+ }
 514+ }
 515+ wglMakeCurrent(dc,NULL);
 516+ wglDeleteContext(rc);
 517+ ReleaseDC(hGLWnd,dc);
 518+ DestroyWindow(hGLWnd);
 519+ // Load global settings.
 520+ // scaler
 521+ _tcscpy(buffer,_T("Change desktop resolution"));
 522+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)buffer);
 523+ _tcscpy(buffer,_T("Stretch to screen"));
 524+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,1,(LPARAM)buffer);
 525+ _tcscpy(buffer,_T("Aspect corrected stretch"));
 526+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,2,(LPARAM)buffer);
 527+ _tcscpy(buffer,_T("Center image on screen"));
 528+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,3,(LPARAM)buffer);
 529+ _tcscpy(buffer,_T("Stretch if mode not found"));
 530+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,4,(LPARAM)buffer);
 531+ _tcscpy(buffer,_T("Scale if mode not found"));
 532+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,5,(LPARAM)buffer);
 533+ _tcscpy(buffer,_T("Center if mode not found"));
 534+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,6,(LPARAM)buffer);
 535+ _tcscpy(buffer,_T("Crop to screen (experimental)"));
 536+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,7,(LPARAM)buffer);
 537+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_SETCURSEL,cfg->scaler,0);
 538+ // colormode
 539+ if(cfg->colormode) SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_CHECKED,0);
 540+ else SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_UNCHECKED,0);
 541+ // scalingfilter
 542+ _tcscpy(buffer,_T("Nearest"));
 543+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)buffer);
 544+ _tcscpy(buffer,_T("Bilinear"));
 545+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,1,(LPARAM)buffer);
 546+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_SETCURSEL,cfg->scalingfilter,0);
 547+ // aspect
 548+ _tcscpy(buffer,_T("Default"));
 549+ SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
 550+ _tcscpy(buffer,_T("4:3"));
 551+ SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
 552+ _tcscpy(buffer,_T("16:10"));
 553+ SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
 554+ _tcscpy(buffer,_T("16:9"));
 555+ SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
 556+ _tcscpy(buffer,_T("5:4"));
 557+ SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
 558+ SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
 559+
 560+ // highres
 561+ if(cfg->highres) SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_CHECKED,0);
 562+ else SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_UNCHECKED,0);
 563+ // texfilter
 564+ _tcscpy(buffer,_T("Application default"));
 565+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)buffer);
 566+ _tcscpy(buffer,_T("Nearest"));
 567+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,1,(LPARAM)buffer);
 568+ _tcscpy(buffer,_T("Bilinear"));
 569+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,2,(LPARAM)buffer);
 570+ _tcscpy(buffer,_T("Nearest, nearest mipmap"));
 571+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,3,(LPARAM)buffer);
 572+ _tcscpy(buffer,_T("Nearest, linear mipmap"));
 573+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,4,(LPARAM)buffer);
 574+ _tcscpy(buffer,_T("Bilinear, nearest mipmap"));
 575+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,5,(LPARAM)buffer);
 576+ _tcscpy(buffer,_T("Bilinear, linear mipmap"));
 577+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,6,(LPARAM)buffer);
 578+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_SETCURSEL,cfg->texfilter,0);
 579+ // anisotropic
 580+ if (anisotropic < 2)
 581+ {
 582+ _tcscpy(buffer,_T("Not supported"));
 583+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
 584+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,0,0);
 585+ EnableWindow(GetDlgItem(hWnd,IDC_ANISO),FALSE);
 586+ cfg->anisotropic = 0;
 587+ }
 588+ else
 589+ {
 590+ _tcscpy(buffer,_T("Application default"));
 591+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
 592+ _tcscpy(buffer,_T("Disabled"));
 593+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,1,(LPARAM)buffer);
 594+ if(anisotropic >= 2)
 595+ {
 596+ _tcscpy(buffer,_T("2x"));
 597+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,2,(LPARAM)buffer);
 598+ }
 599+ if(anisotropic >= 4)
 600+ {
 601+ _tcscpy(buffer,_T("4x"));
 602+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
 603+ }
 604+ if(anisotropic >= 8)
 605+ {
 606+ _tcscpy(buffer,_T("8x"));
 607+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,8,(LPARAM)buffer);
 608+ }
 609+ if(anisotropic >= 16)
 610+ {
 611+ _tcscpy(buffer,_T("16x"));
 612+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,16,(LPARAM)buffer);
 613+ }
 614+ if(anisotropic >= 32)
 615+ {
 616+ _tcscpy(buffer,_T("32x"));
 617+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
 618+ }
 619+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,cfg->anisotropic,0);
 620+ }
 621+ // msaa
 622+ if(msaa)
 623+ {
 624+ _tcscpy(buffer,_T("Application default"));
 625+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
 626+ _tcscpy(buffer,_T("Disabled"));
 627+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,1,(LPARAM)buffer);
 628+ if(maxcoverage)
 629+ {
 630+ for(i = 0; i < maxcoverage; i++)
 631+ {
 632+ if((msaamodes[i] & 0xfff) <= 4)
 633+ _sntprintf(buffer,64,_T("%dx"),msaamodes[i] & 0xfff);
 634+ else _sntprintf(buffer,64,_T("%dx coverage, %dx color"),(msaamodes[i] & 0xfff), (msaamodes[i] >> 12));
 635+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,msaamodes[i],(LPARAM)buffer);
 636+ }
 637+ }
 638+ else
 639+ {
 640+ if(maxsamples >= 2)
 641+ {
 642+ _tcscpy(buffer,_T("2x"));
 643+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,2,(LPARAM)buffer);
 644+ }
 645+ if(maxsamples >= 4)
 646+ {
 647+ _tcscpy(buffer,_T("4x"));
 648+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,4,(LPARAM)buffer);
 649+ }
 650+ if(maxsamples >= 8)
 651+ {
 652+ _tcscpy(buffer,_T("8x"));
 653+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,8,(LPARAM)buffer);
 654+ }
 655+ if(maxsamples >= 16)
 656+ {
 657+ _tcscpy(buffer,_T("16x"));
 658+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,16,(LPARAM)buffer);
 659+ }
 660+ if(maxsamples >= 32)
 661+ {
 662+ _tcscpy(buffer,_T("32x"));
 663+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,32,(LPARAM)buffer);
 664+ }
 665+ }
 666+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,cfg->msaa,0);
 667+ }
 668+ else
 669+ {
 670+ _tcscpy(buffer,_T("Not supported"));
 671+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
 672+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,0,0);
 673+ EnableWindow(GetDlgItem(hWnd,IDC_MSAA),FALSE);
 674+ cfg->msaa = 0;
 675+ }
 676+ // aspect3d
 677+ _tcscpy(buffer,_T("Stretch to display"));
 678+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)buffer);
 679+ _tcscpy(buffer,_T("Expand viewable area"));
 680+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,1,(LPARAM)buffer);
 681+ _tcscpy(buffer,_T("Crop to display"));
 682+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,2,(LPARAM)buffer);
 683+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_SETCURSEL,cfg->aspect3d,0);
 684+ // sort modes
 685+ _tcscpy(buffer,_T("Use system order"));
 686+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)buffer);
 687+ _tcscpy(buffer,_T("Group by color depth"));
 688+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,1,(LPARAM)buffer);
 689+ _tcscpy(buffer,_T("Group by resolution"));
 690+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,2,(LPARAM)buffer);
 691+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_SETCURSEL,cfg->SortModes,0);
 692+ // color depths
 693+ if(cfg->AllColorDepths) SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_CHECKED,0);
 694+ else SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_UNCHECKED,0);
 695+ // extra modes
 696+ if(cfg->ExtraModes) SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_CHECKED,0);
 697+ else SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_UNCHECKED,0);
 698+ // shader path
 699+ SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,FALSE);
 700+ // texture format
 701+ _tcscpy(buffer,_T("Automatic"));
 702+ SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)buffer);
 703+ SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_SETCURSEL,cfg->TextureFormat,0);
 704+ // Texture upload
 705+ _tcscpy(buffer,_T("Automatic"));
 706+ SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)buffer);
 707+ SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_SETCURSEL,cfg->TexUpload,0);
 708+ // DPI
 709+ _tcscpy(buffer, _T("Disabled"));
 710+ SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
 711+ _tcscpy(buffer, _T("Enabled"));
 712+ SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
 713+ _tcscpy(buffer, _T("Windows AppCompat"));
 714+ SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
 715+ SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);
 716+ // Add installed programs
 717+ current_app = 1;
 718+ appcount = 1;
 719+ regbuffersize = 1024;
 720+ regbuffer = (LPTSTR)malloc(regbuffersize*sizeof(TCHAR));
 721+ RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\DXGL"),0,NULL,0,KEY_READ,NULL,&hKeyBase,NULL);
 722+ RegQueryInfoKey(hKeyBase,NULL,NULL,NULL,NULL,&keysize,NULL,NULL,NULL,NULL,NULL,NULL);
 723+ keysize++;
 724+ keyname = (LPTSTR)malloc(keysize*sizeof(TCHAR));
 725+ keysize2 = keysize;
 726+ i = 0;
 727+ while(RegEnumKeyEx(hKeyBase,i,keyname,&keysize2,NULL,NULL,NULL,NULL) == ERROR_SUCCESS)
 728+ {
 729+ keysize2 = keysize;
 730+ i++;
 731+ if(!_tcscmp(keyname,_T("Global"))) continue;
 732+ appcount++;
 733+ if(appcount > maxapps)
 734+ {
 735+ maxapps += 128;
 736+ apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
 737+ }
 738+ if(!_tcscmp(keyname,_T("DXGLTestApp"))) _tcscpy(subkey,_T("dxgltest.exe-0"));
 739+ else _tcscpy(subkey,keyname);
 740+ if (_tcsrchr(subkey, _T('-'))) *(_tcsrchr(subkey, _T('-'))) = 0;
 741+ error = RegOpenKeyEx(hKeyBase,keyname,0,KEY_READ,&hKey);
 742+ buffersize = regbuffersize;
 743+ RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
 744+ if(buffersize > regbuffersize)
 745+ {
 746+ regbuffersize = buffersize;
 747+ regbuffer = (LPTSTR)realloc(regbuffer,regbuffersize);
 748+ }
 749+ buffersize = regbuffersize;
 750+ regbuffer[0] = regbuffer[1] = 0;
 751+ error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
 752+ regbufferpos = 0;
 753+ apps[appcount - 1].regkey = (LPTSTR)malloc((_tcslen(keyname) + 1)*sizeof(TCHAR));
 754+ _tcscpy(apps[appcount - 1].regkey, keyname);
 755+ GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,keyname);
 756+ apps[appcount-1].dirty = FALSE;
 757+ while(1)
 758+ {
 759+ if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
 760+ {
 761+ // Default icon
 762+ apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
 763+ apps[appcount-1].icon_shared = TRUE;
 764+ apps[appcount-1].name = (TCHAR*)malloc((_tcslen(subkey)+1)*sizeof(TCHAR));
 765+ _tcscpy(apps[appcount-1].name,subkey);
 766+ break;
 767+ }
 768+ path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
 769+ _tcslen(subkey) + 2))*sizeof(TCHAR));
 770+ _tcscpy(path, (LPTSTR)regbuffer + regbufferpos);
 771+ _tcscat(path, _T("\\"));
 772+ _tcscat(path, subkey);
 773+ if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
 774+ {
 775+ regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
 776+ free(path);
 777+ continue;
 778+ }
 779+ // Get exe attributes
 780+ error = SHGetFileInfo(path,0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
 781+ apps[appcount-1].icon = fileinfo.hIcon;
 782+ apps[appcount-1].icon_shared = FALSE;
 783+ verinfosize = GetFileVersionInfoSize(path,NULL);
 784+ verinfo = malloc(verinfosize);
 785+ hasname = FALSE;
 786+ if(GetFileVersionInfo(path,0,verinfosize,verinfo))
 787+ {
 788+ if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
 789+ {
 790+ memcpy(translation,outbuffer,4);
 791+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\FileDescription"),translation[0],translation[1]);
 792+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 793+ {
 794+ hasname = TRUE;
 795+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 796+ _tcscpy(apps[appcount - 1].name, outbuffer);
 797+ }
 798+ else
 799+ {
 800+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
 801+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 802+ {
 803+ hasname = TRUE;
 804+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 805+ _tcscpy(apps[appcount - 1].name, outbuffer);
 806+ }
 807+ else
 808+ {
 809+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
 810+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 811+ {
 812+ hasname = TRUE;
 813+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 814+ _tcscpy(apps[appcount - 1].name, outbuffer);
 815+ }
 816+ }
 817+ }
 818+ }
 819+ }
 820+ free(path);
 821+ if (!hasname)
 822+ {
 823+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(subkey) + 1)*sizeof(TCHAR));
 824+ _tcscpy(apps[appcount - 1].name, subkey);
 825+ }
 826+ free(verinfo);
 827+ break;
 828+ }
 829+ RegCloseKey(hKey);
 830+ }
 831+ RegCloseKey(hKeyBase);
 832+ free(keyname);
 833+ for(i = 0; i < appcount; i++)
 834+ {
 835+ SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[i].name);
 836+ }
 837+ current_app = 0;
 838+ SendDlgItemMessage(hWnd,IDC_APPS,LB_SETCURSEL,0,0);
 839+ if(osver.dwMajorVersion >= 6)
 840+ {
 841+ if(OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY,&token))
 842+ {
 843+ if(GetTokenInformation(token,(TOKEN_INFORMATION_CLASS)TokenElevation,&elevation,sizeof(TOKEN_ELEVATION),(PDWORD)&outlen))
 844+ {
 845+ if(!elevation.TokenIsElevated)
 846+ {
 847+ SendDlgItemMessage(hWnd,IDC_ADD,BCM_SETSHIELD,0,TRUE);
 848+ SendDlgItemMessage(hWnd,IDC_REMOVE,BCM_SETSHIELD,0,TRUE);
 849+ }
 850+ }
 851+ }
 852+ }
 853+ else
 854+ {
 855+ EnableWindow(GetDlgItem(hWnd, IDC_DPISCALE), FALSE);
 856+ }
 857+ if(token) CloseHandle(token);
 858+ return TRUE;
 859+ case WM_MEASUREITEM:
 860+ switch(wParam)
 861+ {
 862+ case IDC_APPS:
 863+ ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYSMICON)+1;
 864+ ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXSMICON)+1;
 865+ default:
 866+ break;
 867+ }
 868+ break;
 869+ case WM_DRAWITEM:
 870+ switch(wParam)
 871+ {
 872+ case IDC_APPS:
 873+ OldTextColor = GetTextColor(drawitem->hDC);
 874+ OldBackColor = GetBkColor(drawitem->hDC);
 875+ if((drawitem->itemAction | ODA_SELECT) && (drawitem->itemState & ODS_SELECTED) &&
 876+ !(drawitem->itemState & ODS_COMBOBOXEDIT))
 877+ {
 878+ SetTextColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHTTEXT));
 879+ SetBkColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHT));
 880+ FillRect(drawitem->hDC,&drawitem->rcItem,(HBRUSH)(COLOR_HIGHLIGHT+1));
 881+ }
 882+ else ExtTextOut(drawitem->hDC,0,0,ETO_OPAQUE,&drawitem->rcItem,NULL,0,NULL);
 883+ DrawIconEx(drawitem->hDC,drawitem->rcItem.left+2,drawitem->rcItem.top,
 884+ apps[drawitem->itemID].icon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
 885+ drawitem->rcItem.left += GetSystemMetrics(SM_CXSMICON)+5;
 886+ DrawText(drawitem->hDC,apps[drawitem->itemID].name,
 887+ _tcslen(apps[drawitem->itemID].name),&drawitem->rcItem,
 888+ DT_LEFT|DT_SINGLELINE|DT_VCENTER);
 889+ SetTextColor(drawitem->hDC,OldTextColor);
 890+ SetBkColor(drawitem->hDC,OldBackColor);
 891+ DefWindowProc(hWnd,Msg,wParam,lParam);
 892+ break;
 893+ default:
 894+ break;
 895+ }
 896+ break;
 897+ case WM_HELP:
 898+ HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
 899+ return TRUE;
 900+ break;
 901+ case WM_SYSCOMMAND:
 902+ if(LOWORD(wParam) == SC_CONTEXTHELP)
 903+ {
 904+ HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
 905+ return TRUE;
 906+ }
 907+ break;
 908+ case WM_COMMAND:
 909+ switch(LOWORD(wParam))
 910+ {
 911+ case IDOK:
 912+ SaveChanges(hWnd);
 913+ EndDialog(hWnd,IDOK);
 914+ return TRUE;
 915+ case IDCANCEL:
 916+ EndDialog(hWnd,IDCANCEL);
 917+ return TRUE;
 918+ case IDC_APPLY:
 919+ SaveChanges(hWnd);
 920+ return TRUE;
 921+ case IDC_APPS:
 922+ if(HIWORD(wParam) == LBN_SELCHANGE)
 923+ {
 924+ cursel = SendDlgItemMessage(hWnd,IDC_APPS,LB_GETCURSEL,0,0);
 925+ if(cursel == current_app) break;
 926+ current_app = cursel;
 927+ cfg = &apps[current_app].cfg;
 928+ cfgmask = &apps[current_app].mask;
 929+ dirty = &apps[current_app].dirty;
 930+ if(current_app)
 931+ {
 932+ if(!_tcscmp(apps[current_app].regkey,_T("DXGLTestApp"))) EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE);
 933+ else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE);
 934+ }
 935+ else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE);
 936+ // Set 3-state status
 937+ if(current_app && !tristate)
 938+ {
 939+ tristate = TRUE;
 940+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)strdefault);
 941+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)strdefault);
 942+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)strdefault);
 943+ SendDlgItemMessage(hWnd,IDC_VSYNC,CB_ADDSTRING,0,(LPARAM)strdefault);
 944+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)strdefault);
 945+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)strdefault);
 946+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)strdefault);
 947+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)strdefault);
 948+ SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
 949+ SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
 950+ SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
 951+ SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
 952+ SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)strdefault);
 953+ SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)strdefault);
 954+ SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
 955+ SendDlgItemMessage(hWnd, IDC_ASPECT, CB_ADDSTRING, 0, (LPARAM)strdefault);
 956+ }
 957+ else if(!current_app && tristate)
 958+ {
 959+ tristate = FALSE;
 960+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_DELETESTRING,
 961+ SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 962+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_DELETESTRING,
 963+ SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 964+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_DELETESTRING,
 965+ SendDlgItemMessage(hWnd,IDC_SCALE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 966+ SendDlgItemMessage(hWnd,IDC_VSYNC,CB_DELETESTRING,
 967+ SendDlgItemMessage(hWnd,IDC_VSYNC,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 968+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_DELETESTRING,
 969+ SendDlgItemMessage(hWnd,IDC_MSAA,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 970+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_DELETESTRING,
 971+ SendDlgItemMessage(hWnd,IDC_ANISO,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 972+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_DELETESTRING,
 973+ SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 974+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_DELETESTRING,
 975+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 976+ SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
 977+ SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
 978+ SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
 979+ SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
 980+ SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_DELETESTRING,
 981+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 982+ SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_DELETESTRING,
 983+ SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
 984+ SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_DELETESTRING,
 985+ SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 986+ SendDlgItemMessage(hWnd, IDC_ASPECT, CB_DELETESTRING,
 987+ SendDlgItemMessage(hWnd, IDC_ASPECT, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 988+ }
 989+ // Read settings into controls
 990+ SetCombo(hWnd,IDC_VIDMODE,cfg->scaler,cfgmask->scaler,tristate);
 991+ SetCombo(hWnd,IDC_SORTMODES,cfg->SortModes,cfgmask->SortModes,tristate);
 992+ SetCombo(hWnd,IDC_SCALE,cfg->scalingfilter,cfgmask->scalingfilter,tristate);
 993+ SetCombo(hWnd,IDC_VSYNC,cfg->vsync,cfgmask->vsync,tristate);
 994+ SetCombo(hWnd,IDC_MSAA,cfg->msaa,cfgmask->msaa,tristate);
 995+ SetCombo(hWnd,IDC_ANISO,cfg->anisotropic,cfgmask->anisotropic,tristate);
 996+ SetCombo(hWnd,IDC_TEXFILTER,cfg->texfilter,cfgmask->texfilter,tristate);
 997+ SetCombo(hWnd,IDC_ASPECT3D,cfg->aspect3d,cfgmask->aspect3d,tristate);
 998+ SetCheck(hWnd,IDC_COLOR,cfg->colormode,cfgmask->colormode,tristate);
 999+ SetCheck(hWnd,IDC_HIGHRES,cfg->highres,cfgmask->highres,tristate);
 1000+ SetCheck(hWnd,IDC_UNCOMMONCOLOR,cfg->AllColorDepths,cfgmask->AllColorDepths,tristate);
 1001+ SetCombo(hWnd,IDC_TEXTUREFORMAT,cfg->TextureFormat,cfgmask->TextureFormat,tristate);
 1002+ SetCombo(hWnd,IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
 1003+ SetCheck(hWnd,IDC_EXTRAMODES,cfg->ExtraModes,cfgmask->ExtraModes,tristate);
 1004+ SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,tristate);
 1005+ SetCombo(hWnd, IDC_DPISCALE, cfg->DPIScale, cfgmask->DPIScale, tristate);
 1006+ SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
 1007+ }
 1008+ case IDC_VIDMODE:
 1009+ cfg->scaler = GetCombo(hWnd,IDC_VIDMODE,&cfgmask->scaler);
 1010+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1011+ *dirty = TRUE;
 1012+ break;
 1013+ case IDC_SORTMODES:
 1014+ cfg->SortModes = GetCombo(hWnd,IDC_SORTMODES,&cfgmask->SortModes);
 1015+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1016+ *dirty = TRUE;
 1017+ break;
 1018+ case IDC_SCALE:
 1019+ cfg->scalingfilter = GetCombo(hWnd,IDC_SCALE,&cfgmask->scalingfilter);
 1020+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1021+ *dirty = TRUE;
 1022+ break;
 1023+ case IDC_VSYNC:
 1024+ cfg->vsync = GetCombo(hWnd,IDC_VSYNC,&cfgmask->vsync);
 1025+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1026+ *dirty = TRUE;
 1027+ break;
 1028+ case IDC_MSAA:
 1029+ cfg->msaa = GetCombo(hWnd,IDC_MSAA,&cfgmask->msaa);
 1030+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1031+ *dirty = TRUE;
 1032+ break;
 1033+ case IDC_ANISO:
 1034+ cfg->anisotropic = GetCombo(hWnd,IDC_ANISO,&cfgmask->anisotropic);
 1035+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1036+ *dirty = TRUE;
 1037+ break;
 1038+ case IDC_TEXFILTER:
 1039+ cfg->texfilter = GetCombo(hWnd,IDC_TEXFILTER,&cfgmask->texfilter);
 1040+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1041+ *dirty = TRUE;
 1042+ break;
 1043+ case IDC_ASPECT3D:
 1044+ cfg->aspect3d = GetCombo(hWnd,IDC_ASPECT3D,&cfgmask->aspect3d);
 1045+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1046+ *dirty = TRUE;
 1047+ break;
 1048+ case IDC_COLOR:
 1049+ cfg->colormode = GetCheck(hWnd,IDC_COLOR,&cfgmask->colormode);
 1050+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1051+ *dirty = TRUE;
 1052+ break;
 1053+ case IDC_HIGHRES:
 1054+ cfg->highres = GetCheck(hWnd,IDC_HIGHRES,&cfgmask->highres);
 1055+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1056+ *dirty = TRUE;
 1057+ break;
 1058+ case IDC_UNCOMMONCOLOR:
 1059+ cfg->AllColorDepths = GetCheck(hWnd,IDC_UNCOMMONCOLOR,&cfgmask->AllColorDepths);
 1060+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1061+ *dirty = TRUE;
 1062+ break;
 1063+ case IDC_EXTRAMODES:
 1064+ cfg->ExtraModes = GetCheck(hWnd,IDC_EXTRAMODES,&cfgmask->ExtraModes);
 1065+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1066+ *dirty = TRUE;
 1067+ break;
 1068+ case IDC_TEXTUREFORMAT:
 1069+ cfg->TextureFormat = GetCombo(hWnd,IDC_TEXTUREFORMAT,&cfgmask->TextureFormat);
 1070+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1071+ *dirty = TRUE;
 1072+ break;
 1073+ case IDC_TEXUPLOAD:
 1074+ cfg->TexUpload = GetCombo(hWnd,IDC_TEXUPLOAD,&cfgmask->TexUpload);
 1075+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1076+ *dirty = TRUE;
 1077+ break;
 1078+ case IDC_DPISCALE:
 1079+ cfg->DPIScale = GetCombo(hWnd,IDC_DPISCALE,&cfgmask->DPIScale);
 1080+ EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
 1081+ *dirty = TRUE;
 1082+ break;
 1083+ case IDC_SHADER:
 1084+ if(HIWORD(wParam) == EN_CHANGE)
 1085+ {
 1086+ GetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile);
 1087+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
 1088+ *dirty = TRUE;
 1089+ }
 1090+ break;
 1091+ case IDC_ASPECT:
 1092+ if (HIWORD(wParam) == CBN_KILLFOCUS)
 1093+ {
 1094+ cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, &cfgmask->aspect);
 1095+ SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
 1096+ EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
 1097+ *dirty = TRUE;
 1098+ }
 1099+ else if (HIWORD(wParam) == CBN_SELCHANGE)
 1100+ {
 1101+ cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, &cfgmask->aspect);
 1102+ EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
 1103+ *dirty = TRUE;
 1104+ }
 1105+ break;
 1106+ case IDC_ADD:
 1107+ selectedfile[0] = 0;
 1108+ ZeroMemory(&filename,OPENFILENAME_SIZE_VERSION_400);
 1109+ filename.lStructSize = OPENFILENAME_SIZE_VERSION_400;
 1110+ filename.hwndOwner = hWnd;
 1111+ filename.lpstrFilter = exe_filter;
 1112+ filename.lpstrFile = selectedfile;
 1113+ filename.nMaxFile = MAX_PATH+1;
 1114+ filename.lpstrInitialDir = _T("%ProgramFiles%");
 1115+ filename.lpstrTitle = _T("Select program");
 1116+ filename.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
 1117+ if(GetOpenFileName(&filename))
 1118+ {
 1119+ DWORD err = AddApp(filename.lpstrFile,TRUE,FALSE);
 1120+ if(!err)
 1121+ {
 1122+ LPTSTR newkey = MakeNewConfig(filename.lpstrFile);
 1123+ LPTSTR newkey2 = (LPTSTR)malloc((_tcslen(newkey) + 15)*sizeof(TCHAR));
 1124+ _tcscpy(newkey2, _T("Software\\DXGL\\"));
 1125+ _tcscat(newkey2,newkey);
 1126+ appcount++;
 1127+ if(appcount > maxapps)
 1128+ {
 1129+ maxapps += 128;
 1130+ apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
 1131+ }
 1132+ RegOpenKeyEx(HKEY_CURRENT_USER,newkey2,0,KEY_READ,&hKey);
 1133+ RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
 1134+ regbuffer = (LPTSTR)malloc(buffersize);
 1135+ regbuffer[0] = regbuffer[1] = 0;
 1136+ error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
 1137+ regbufferpos = 0;
 1138+ apps[appcount - 1].regkey = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
 1139+ _tcscpy(apps[appcount - 1].regkey, newkey);
 1140+ GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,newkey);
 1141+ apps[appcount-1].dirty = FALSE;
 1142+ free(newkey2);
 1143+ while(1)
 1144+ {
 1145+ if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
 1146+ {
 1147+ // Default icon
 1148+ apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
 1149+ apps[appcount-1].icon_shared = TRUE;
 1150+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
 1151+ _tcscpy(apps[appcount - 1].name, newkey);
 1152+ break;
 1153+ }
 1154+ if (_tcsrchr(newkey, _T('-'))) *(_tcsrchr(newkey, _T('-'))) = 0;
 1155+ path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
 1156+ _tcslen(newkey) + 2))*sizeof(TCHAR));
 1157+ _tcscpy(path, (LPTSTR)regbuffer + regbufferpos);
 1158+ _tcscat(path, _T("\\"));
 1159+ _tcscat(path, newkey);
 1160+ if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
 1161+ {
 1162+ regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
 1163+ free(path);
 1164+ continue;
 1165+ }
 1166+ // Get exe attributes
 1167+ error = SHGetFileInfo(path,0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
 1168+ apps[appcount-1].icon = fileinfo.hIcon;
 1169+ apps[appcount-1].icon_shared = FALSE;
 1170+ verinfosize = GetFileVersionInfoSize(path,NULL);
 1171+ verinfo = malloc(verinfosize);
 1172+ hasname = FALSE;
 1173+ if(GetFileVersionInfo(path,0,verinfosize,verinfo))
 1174+ {
 1175+ if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
 1176+ {
 1177+ memcpy(translation,outbuffer,4);
 1178+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\FileDescription"),translation[0],translation[1]);
 1179+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 1180+ {
 1181+ hasname = TRUE;
 1182+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 1183+ _tcscpy(apps[appcount - 1].name, outbuffer);
 1184+ }
 1185+ else
 1186+ {
 1187+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
 1188+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 1189+ {
 1190+ hasname = TRUE;
 1191+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 1192+ _tcscpy(apps[appcount - 1].name, outbuffer);
 1193+ }
 1194+ else
 1195+ {
 1196+ _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
 1197+ if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
 1198+ {
 1199+ hasname = TRUE;
 1200+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
 1201+ _tcscpy(apps[appcount - 1].name, outbuffer);
 1202+ }
 1203+ }
 1204+ }
 1205+ }
 1206+ }
 1207+ if (!hasname)
 1208+ {
 1209+ apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
 1210+ _tcscpy(apps[appcount - 1].name, newkey);
 1211+ }
 1212+ free(verinfo);
 1213+ free(path);
 1214+ break;
 1215+ }
 1216+ SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[appcount-1].name);
 1217+ RegCloseKey(hKey);
 1218+ free(regbuffer);
 1219+ }
 1220+ }
 1221+
 1222+ break;
 1223+ case IDC_REMOVE:
 1224+ if(MessageBox(hWnd,_T("Do you want to delete the selected application profile and remove DXGL from its installation folder(s)?"),
 1225+ _T("Confirmation"),MB_YESNO|MB_ICONQUESTION) != IDYES) return FALSE;
 1226+ regpath = (LPTSTR)malloc((_tcslen(apps[current_app].regkey) + 15)*sizeof(TCHAR));
 1227+ _tcscpy(regpath, _T("Software\\DXGL\\"));
 1228+ _tcscat(regpath, apps[current_app].regkey);
 1229+ regkey = (LPTSTR)malloc(_tcslen(apps[current_app].regkey));
 1230+ _tcscpy(regkey, apps[current_app].regkey);
 1231+ RegOpenKeyEx(HKEY_CURRENT_USER,regpath,0,KEY_READ,&hKey);
 1232+ RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
 1233+ regbuffer = (LPTSTR)malloc(buffersize);
 1234+ regbuffer[0] = regbuffer[1] = 0;
 1235+ error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
 1236+ regbufferpos = 0;
 1237+ failed = FALSE;
 1238+ while(1)
 1239+ {
 1240+ if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS) break;
 1241+ if (_tcsrchr(regkey, _T('-'))) *(_tcsrchr(regkey, _T('-'))) = 0;
 1242+ path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
 1243+ 12))*sizeof(TCHAR));
 1244+ _tcscpy(path, regbuffer + regbufferpos);
 1245+ _tcscat(path, _T("\\ddraw.dll"));
 1246+ if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
 1247+ {
 1248+ regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
 1249+ free(path);
 1250+ continue;
 1251+ }
 1252+ if(DelApp(path,FALSE)) failed = TRUE;
 1253+ regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
 1254+ free(path);
 1255+ }
 1256+ RegCloseKey(hKey);
 1257+ if(!failed)
 1258+ {
 1259+ RegDeleteKey(HKEY_CURRENT_USER,regpath);
 1260+ if(!apps[current_app].icon_shared) DeleteObject(apps[current_app].icon);
 1261+ if(apps[current_app].name) free(apps[current_app].name);
 1262+ if(apps[current_app].regkey) free(apps[current_app].regkey);
 1263+ for(i = current_app; i < appcount; i++)
 1264+ {
 1265+ apps[i] = apps[i+1];
 1266+ }
 1267+ appcount--;
 1268+ }
 1269+ SendDlgItemMessage(hWnd,IDC_APPS,LB_DELETESTRING,current_app,0);
 1270+ break;
 1271+ }
 1272+ break;
 1273+ }
 1274+ return FALSE;
 1275+}
 1276+
 1277+int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 1278+{
 1279+ INITCOMMONCONTROLSEX icc;
 1280+ HMODULE comctl32;
 1281+ BOOL(WINAPI *iccex)(LPINITCOMMONCONTROLSEX lpInitCtrls);
 1282+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 1283+ GetVersionEx(&osver);
 1284+ CoInitialize(NULL);
 1285+ if(!_tcsnicmp(lpCmdLine,_T("install "),8))
 1286+ {
 1287+ return AddApp(lpCmdLine+8,TRUE,TRUE);
 1288+ }
 1289+ if(!_tcsnicmp(lpCmdLine,_T("remove "),7))
 1290+ {
 1291+ return DelApp(lpCmdLine+7,TRUE);
 1292+ }
 1293+ icc.dwSize = sizeof(icc);
 1294+ icc.dwICC = ICC_WIN95_CLASSES;
 1295+ comctl32 = LoadLibrary(_T("comctl32.dll"));
 1296+ iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
 1297+ if(iccex) iccex(&icc);
 1298+ else InitCommonControls();
 1299+ hinstance = hInstance;
 1300+ GetModuleFileName(NULL,hlppath,MAX_PATH);
 1301+ GetDirFromPath(hlppath);
 1302+ _tcscat(hlppath,_T("\\dxgl.chm"));
 1303+ DialogBox(hInstance,MAKEINTRESOURCE(IDD_DXGLCFG),0,(DLGPROC)DXGLCfgCallback);
 1304+#ifdef _DEBUG
 1305+ _CrtDumpMemoryLeaks();
 1306+#endif
 1307+ return 0;
 1308+}
Index: dxglcfg2/dxglcfg2.rc
——@@ -0,0 +1,134 @@
 2+// DXGL
 3+// Copyright (C) 2011-2012 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#include <windows.h>
 20+#include <commctrl.h>
 21+#include <richedit.h>
 22+#include "resource.h"
 23+#include "../common/version.h"
 24+
 25+
 26+
 27+
 28+//
 29+// Dialog resources
 30+//
 31+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 32+IDD_DXGLCFG DIALOG 0, 0, 405, 265
 33+STYLE DS_3DLOOK | DS_CONTEXTHELP | DS_SETFONT | WS_CAPTION | WS_SYSMENU
 34+CAPTION "DXGL Config"
 35+FONT 8, "Ms Shell Dlg 2"
 36+{
 37+ DEFPUSHBUTTON "OK", IDOK, 247, 247, 50, 14
 38+ PUSHBUTTON "Cancel", IDCANCEL, 299, 247, 50, 14
 39+ LTEXT "", IDC_STATIC, 4, 244, 397, 1, SS_LEFT | SS_SUNKEN
 40+ PUSHBUTTON "&Apply", IDC_APPLY, 351, 247, 50, 14, WS_DISABLED
 41+ LISTBOX IDC_APPS, 4, 14, 181, 212, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_OWNERDRAWFIXED | LBS_NOTIFY
 42+ LTEXT "Applications", IDC_STATIC, 4, 4, 39, 8, SS_LEFT
 43+ PUSHBUTTON "A&dd...", IDC_ADD, 4, 228, 90, 14
 44+ PUSHBUTTON "&Remove", IDC_REMOVE, 96, 228, 90, 14, WS_DISABLED
 45+ GROUPBOX "Graphics", IDC_STATIC, 190, 4, 211, 238
 46+ LTEXT "Video mode", IDC_STATIC, 195, 14, 38, 8, SS_LEFT
 47+ COMBOBOX IDC_VIDMODE, 195, 24, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 48+ AUTOCHECKBOX "Change display color depth", IDC_COLOR, 299, 14, 100, 10
 49+ LTEXT "Scaling method", IDC_STATIC, 195, 69, 49, 8, SS_LEFT
 50+ COMBOBOX IDC_SCALE, 195, 79, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 51+ LTEXT "Vertical sync", IDC_STATIC, 299, 69, 41, 8, SS_LEFT
 52+ COMBOBOX IDC_VSYNC, 299, 79, 100, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 53+ LTEXT "Post-processing shader", IDC_STATIC, 195, 94, 90, 8, SS_LEFT
 54+ EDITTEXT IDC_SHADER, 195, 104, 183, 14, ES_AUTOHSCROLL
 55+ PUSHBUTTON "...", IDC_BROWSESHADER, 379, 104, 20, 14
 56+ LTEXT "Screen aspect ratio", IDC_STATIC, 195, 120, 63, 8, SS_LEFT
 57+ LTEXT "DPI scaling mode", IDC_STATIC, 299, 120, 55, 8, SS_LEFT
 58+ COMBOBOX IDC_ASPECT, 195, 130, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS
 59+ COMBOBOX IDC_DPISCALE, 299, 130, 100, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 60+ LTEXT "Texture filter", IDC_STATIC, 195, 145, 43, 8, SS_LEFT
 61+ COMBOBOX IDC_TEXFILTER, 195, 155, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 62+ LTEXT "Anisotropic filtering", IDC_STATIC, 299, 145, 62, 8, SS_LEFT
 63+ COMBOBOX IDC_ANISO, 299, 155, 100, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 64+ LTEXT "Antialiasing (MSAA)", IDC_STATIC, 195, 170, 63, 8, SS_LEFT
 65+ COMBOBOX IDC_MSAA, 195, 180, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 66+ LTEXT "Renderer aspect ratio", IDC_STATIC, 299, 170, 71, 8, SS_LEFT
 67+ COMBOBOX IDC_ASPECT3D, 299, 180, 100, 14, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 68+ AUTOCHECKBOX "Adjust primary resolution", IDC_HIGHRES, 299, 28, 96, 8
 69+ AUTOCHECKBOX "Support all color depths", IDC_UNCOMMONCOLOR, 299, 55, 91, 8
 70+ AUTOCHECKBOX "Add extra display modes", IDC_EXTRAMODES, 299, 42, 95, 8
 71+ LTEXT "Sort video modes", IDC_STATIC, 195, 39, 56, 8, SS_LEFT
 72+ COMBOBOX IDC_SORTMODES, 195, 49, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 73+ LTEXT "Texture format", IDC_STATIC, 195, 195, 50, 8, SS_LEFT
 74+ COMBOBOX IDC_TEXTUREFORMAT, 195, 205, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 75+ LTEXT "Texture access method", IDC_STATIC, 299, 195, 76, 8, SS_LEFT
 76+ COMBOBOX IDC_TEXUPLOAD, 299, 205, 100, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 77+}
 78+
 79+
 80+
 81+//
 82+// Icon resources
 83+//
 84+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 85+IDI_DXGL ICON "..\\common\\dxgl.ico"
 86+
 87+
 88+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 89+IDI_DXGLSM ICON "..\\common\\dxglsm.ico"
 90+
 91+
 92+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 93+IDI_STAR ICON "..\\common\\star.ico"
 94+
 95+
 96+
 97+//
 98+// Version Information resources
 99+//
 100+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 101+1 VERSIONINFO
 102+ FILEVERSION DXGLVERNUMBER
 103+ PRODUCTVERSION DXGLVERNUMBER
 104+ FILEOS VOS__WINDOWS32
 105+ FILETYPE VFT_APP
 106+ FILESUBTYPE VFT2_UNKNOWN
 107+ FILEFLAGSMASK 0x00000000
 108+ FILEFLAGS 0x00000000
 109+{
 110+ BLOCK "StringFileInfo"
 111+ {
 112+ BLOCK "08000352"
 113+ {
 114+ VALUE "FileDescription", "DXGL Configuration Program"
 115+ VALUE "FileVersion", DXGLVERSTRING
 116+ VALUE "InternalName", "DXGL"
 117+ VALUE "LegalCopyright", "Copyright © 2011-2014 William Feely"
 118+ VALUE "OriginalFilename", "dxglcfg.exe"
 119+ VALUE "ProductName", "DXGL"
 120+ VALUE "ProductVersion", DXGLVERSTRING
 121+ }
 122+ }
 123+ BLOCK "VarFileInfo"
 124+ {
 125+ VALUE "Translation", 0x0800, 0x0352
 126+ }
 127+}
 128+
 129+
 130+
 131+//
 132+// Manifest resources
 133+//
 134+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 135+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "xp.manifest"
Index: dxglcfg2/dxglcfg2.vcxproj
——@@ -0,0 +1,196 @@
 2+<?xml version="1.0" encoding="utf-8"?>
 3+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 4+ <ItemGroup Label="ProjectConfigurations">
 5+ <ProjectConfiguration Include="Debug no DXGL|Win32">
 6+ <Configuration>Debug no DXGL</Configuration>
 7+ <Platform>Win32</Platform>
 8+ </ProjectConfiguration>
 9+ <ProjectConfiguration Include="Debug No MSVCRT|Win32">
 10+ <Configuration>Debug No MSVCRT</Configuration>
 11+ <Platform>Win32</Platform>
 12+ </ProjectConfiguration>
 13+ <ProjectConfiguration Include="Debug|Win32">
 14+ <Configuration>Debug</Configuration>
 15+ <Platform>Win32</Platform>
 16+ </ProjectConfiguration>
 17+ <ProjectConfiguration Include="Release no DXGL|Win32">
 18+ <Configuration>Release no DXGL</Configuration>
 19+ <Platform>Win32</Platform>
 20+ </ProjectConfiguration>
 21+ <ProjectConfiguration Include="Release|Win32">
 22+ <Configuration>Release</Configuration>
 23+ <Platform>Win32</Platform>
 24+ </ProjectConfiguration>
 25+ </ItemGroup>
 26+ <PropertyGroup Label="Globals">
 27+ <ProjectGuid>{C59AC409-F7D0-4153-9874-184CA00D537B}</ProjectGuid>
 28+ <Keyword>Win32Proj</Keyword>
 29+ <RootNamespace>dxglcfg2</RootNamespace>
 30+ </PropertyGroup>
 31+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 32+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
 33+ <ConfigurationType>Application</ConfigurationType>
 34+ <UseDebugLibraries>true</UseDebugLibraries>
 35+ <CharacterSet>Unicode</CharacterSet>
 36+ </PropertyGroup>
 37+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'" Label="Configuration">
 38+ <ConfigurationType>Application</ConfigurationType>
 39+ <UseDebugLibraries>true</UseDebugLibraries>
 40+ <CharacterSet>Unicode</CharacterSet>
 41+ </PropertyGroup>
 42+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'" Label="Configuration">
 43+ <ConfigurationType>Application</ConfigurationType>
 44+ <UseDebugLibraries>true</UseDebugLibraries>
 45+ <CharacterSet>Unicode</CharacterSet>
 46+ </PropertyGroup>
 47+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
 48+ <ConfigurationType>Application</ConfigurationType>
 49+ <UseDebugLibraries>false</UseDebugLibraries>
 50+ <WholeProgramOptimization>true</WholeProgramOptimization>
 51+ <CharacterSet>Unicode</CharacterSet>
 52+ </PropertyGroup>
 53+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'" Label="Configuration">
 54+ <ConfigurationType>Application</ConfigurationType>
 55+ <UseDebugLibraries>false</UseDebugLibraries>
 56+ <WholeProgramOptimization>true</WholeProgramOptimization>
 57+ <CharacterSet>Unicode</CharacterSet>
 58+ </PropertyGroup>
 59+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
 60+ <ImportGroup Label="ExtensionSettings">
 61+ </ImportGroup>
 62+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 63+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 64+ </ImportGroup>
 65+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'" Label="PropertySheets">
 66+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 67+ </ImportGroup>
 68+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'" Label="PropertySheets">
 69+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 70+ </ImportGroup>
 71+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 72+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 73+ </ImportGroup>
 74+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'" Label="PropertySheets">
 75+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 76+ </ImportGroup>
 77+ <PropertyGroup Label="UserMacros" />
 78+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 79+ <LinkIncremental>true</LinkIncremental>
 80+ <GenerateManifest>false</GenerateManifest>
 81+ </PropertyGroup>
 82+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">
 83+ <LinkIncremental>true</LinkIncremental>
 84+ <GenerateManifest>false</GenerateManifest>
 85+ </PropertyGroup>
 86+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">
 87+ <LinkIncremental>true</LinkIncremental>
 88+ <GenerateManifest>false</GenerateManifest>
 89+ </PropertyGroup>
 90+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 91+ <LinkIncremental>false</LinkIncremental>
 92+ <GenerateManifest>false</GenerateManifest>
 93+ </PropertyGroup>
 94+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
 95+ <LinkIncremental>false</LinkIncremental>
 96+ <GenerateManifest>false</GenerateManifest>
 97+ </PropertyGroup>
 98+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 99+ <ClCompile>
 100+ <PrecompiledHeader>
 101+ </PrecompiledHeader>
 102+ <WarningLevel>Level3</WarningLevel>
 103+ <Optimization>Disabled</Optimization>
 104+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 105+ <AdditionalIncludeDirectories>../glew/glew-1.6.0/include</AdditionalIncludeDirectories>
 106+ </ClCompile>
 107+ <Link>
 108+ <SubSystem>Windows</SubSystem>
 109+ <GenerateDebugInformation>true</GenerateDebugInformation>
 110+ <AdditionalDependencies>$(OutDir)cfgmgr.lib;opengl32.lib;Comctl32.lib;Version.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
 111+ </Link>
 112+ </ItemDefinitionGroup>
 113+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">
 114+ <ClCompile>
 115+ <PrecompiledHeader>
 116+ </PrecompiledHeader>
 117+ <WarningLevel>Level3</WarningLevel>
 118+ <Optimization>Disabled</Optimization>
 119+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 120+ <AdditionalIncludeDirectories>../glew/glew-1.6.0/include</AdditionalIncludeDirectories>
 121+ </ClCompile>
 122+ <Link>
 123+ <SubSystem>Windows</SubSystem>
 124+ <GenerateDebugInformation>true</GenerateDebugInformation>
 125+ <AdditionalDependencies>$(OutDir)cfgmgr.lib;opengl32.lib;Comctl32.lib;Version.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
 126+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
 127+ </Link>
 128+ </ItemDefinitionGroup>
 129+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">
 130+ <ClCompile>
 131+ <PrecompiledHeader>
 132+ </PrecompiledHeader>
 133+ <WarningLevel>Level3</WarningLevel>
 134+ <Optimization>Disabled</Optimization>
 135+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 136+ <AdditionalIncludeDirectories>../glew/glew-1.6.0/include</AdditionalIncludeDirectories>
 137+ </ClCompile>
 138+ <Link>
 139+ <SubSystem>Windows</SubSystem>
 140+ <GenerateDebugInformation>true</GenerateDebugInformation>
 141+ <AdditionalDependencies>$(OutDir)cfgmgr.lib;opengl32.lib;Comctl32.lib;Version.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
 142+ </Link>
 143+ </ItemDefinitionGroup>
 144+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 145+ <ClCompile>
 146+ <WarningLevel>Level3</WarningLevel>
 147+ <PrecompiledHeader>
 148+ </PrecompiledHeader>
 149+ <Optimization>MaxSpeed</Optimization>
 150+ <FunctionLevelLinking>true</FunctionLevelLinking>
 151+ <IntrinsicFunctions>true</IntrinsicFunctions>
 152+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 153+ <AdditionalIncludeDirectories>../glew/glew-1.6.0/include</AdditionalIncludeDirectories>
 154+ </ClCompile>
 155+ <Link>
 156+ <SubSystem>Windows</SubSystem>
 157+ <GenerateDebugInformation>true</GenerateDebugInformation>
 158+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
 159+ <OptimizeReferences>true</OptimizeReferences>
 160+ <AdditionalDependencies>$(OutDir)cfgmgr.lib;opengl32.lib;Comctl32.lib;Version.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
 161+ </Link>
 162+ </ItemDefinitionGroup>
 163+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
 164+ <ClCompile>
 165+ <WarningLevel>Level3</WarningLevel>
 166+ <PrecompiledHeader>
 167+ </PrecompiledHeader>
 168+ <Optimization>MaxSpeed</Optimization>
 169+ <FunctionLevelLinking>true</FunctionLevelLinking>
 170+ <IntrinsicFunctions>true</IntrinsicFunctions>
 171+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 172+ <AdditionalIncludeDirectories>../glew/glew-1.6.0/include</AdditionalIncludeDirectories>
 173+ </ClCompile>
 174+ <Link>
 175+ <SubSystem>Windows</SubSystem>
 176+ <GenerateDebugInformation>true</GenerateDebugInformation>
 177+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
 178+ <OptimizeReferences>true</OptimizeReferences>
 179+ <AdditionalDependencies>$(OutDir)cfgmgr.lib;opengl32.lib;Comctl32.lib;Version.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
 180+ </Link>
 181+ </ItemDefinitionGroup>
 182+ <ItemGroup>
 183+ <ResourceCompile Include="dxglcfg2.rc" />
 184+ </ItemGroup>
 185+ <ItemGroup>
 186+ <ClInclude Include="resource.h" />
 187+ </ItemGroup>
 188+ <ItemGroup>
 189+ <ClCompile Include="dxglcfg2.c" />
 190+ </ItemGroup>
 191+ <ItemGroup>
 192+ <Manifest Include="xp.manifest" />
 193+ </ItemGroup>
 194+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 195+ <ImportGroup Label="ExtensionTargets">
 196+ </ImportGroup>
 197+</Project>
\ No newline at end of file
Index: dxglcfg2/dxglcfg2.vcxproj.filters
——@@ -0,0 +1,37 @@
 2+<?xml version="1.0" encoding="utf-8"?>
 3+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 4+ <ItemGroup>
 5+ <Filter Include="Source Files">
 6+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
 7+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
 8+ </Filter>
 9+ <Filter Include="Header Files">
 10+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
 11+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
 12+ </Filter>
 13+ <Filter Include="Resource Files">
 14+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
 15+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
 16+ </Filter>
 17+ </ItemGroup>
 18+ <ItemGroup>
 19+ <ResourceCompile Include="dxglcfg2.rc">
 20+ <Filter>Resource Files</Filter>
 21+ </ResourceCompile>
 22+ </ItemGroup>
 23+ <ItemGroup>
 24+ <ClInclude Include="resource.h">
 25+ <Filter>Header Files</Filter>
 26+ </ClInclude>
 27+ </ItemGroup>
 28+ <ItemGroup>
 29+ <Manifest Include="xp.manifest">
 30+ <Filter>Resource Files</Filter>
 31+ </Manifest>
 32+ </ItemGroup>
 33+ <ItemGroup>
 34+ <ClCompile Include="dxglcfg2.c">
 35+ <Filter>Source Files</Filter>
 36+ </ClCompile>
 37+ </ItemGroup>
 38+</Project>
\ No newline at end of file
Index: dxglcfg2/resource.h
——@@ -0,0 +1,47 @@
 2+// DXGL
 3+// Copyright (C) 2011-2012 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#ifndef IDC_STATIC
 20+#define IDC_STATIC (-1)
 21+#endif
 22+
 23+#define IDD_DXGLCFG 103
 24+#define IDI_DXGL 107
 25+#define IDI_DXGLSM 109
 26+#define IDI_STAR 111
 27+#define IDC_ASPECT3D 1000
 28+#define IDC_HIGHRES 1002
 29+#define IDC_SORTMODES 1003
 30+#define IDC_UNCOMMONCOLOR 1004
 31+#define IDC_APPLY 1015
 32+#define IDC_APPS 1037
 33+#define IDC_ADD 1038
 34+#define IDC_REMOVE 1039
 35+#define IDC_VIDMODE 1041
 36+#define IDC_SCALE 1042
 37+#define IDC_VSYNC 1043
 38+#define IDC_SHADER 1044
 39+#define IDC_BROWSESHADER 1045
 40+#define IDC_TEXFILTER 1046
 41+#define IDC_ANISO 1047
 42+#define IDC_MSAA 1048
 43+#define IDC_COLOR 1049
 44+#define IDC_EXTRAMODES 1055
 45+#define IDC_TEXTUREFORMAT 1058
 46+#define IDC_TEXUPLOAD 1059
 47+#define IDC_ASPECT 1061
 48+#define IDC_DPISCALE 1063
Index: dxglcfg2/xp.manifest
——@@ -0,0 +1,36 @@
 2+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 3+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
 4+ <assemblyIdentity
 5+ version="1.0.0.0"
 6+ processorArchitecture="X86"
 7+ name="WilliamFeely.DXGL.DXGLCfg"
 8+ type="win32"
 9+/>
 10+<description>DXGL Configuration Program</description>
 11+<dependency>
 12+ <dependentAssembly>
 13+ <assemblyIdentity
 14+ type="win32"
 15+ name="Microsoft.Windows.Common-Controls"
 16+ version="6.0.0.0"
 17+ processorArchitecture="X86"
 18+ publicKeyToken="6595b64144ccf1df"
 19+ language="*"
 20+ />
 21+ </dependentAssembly>
 22+</dependency>
 23+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
 24+ <application>
 25+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
 26+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
 27+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
 28+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
 29+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
 30+ </application>
 31+ </compatibility>
 32+ <asmv3:application>
 33+ <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
 34+ <dpiAware>true/pm</dpiAware>
 35+ </asmv3:windowsSettings>
 36+ </asmv3:application>
 37+</assembly>
\ No newline at end of file
Index: dxglcfg2
Property changes on: dxglcfg2
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
 38+dxglcfg2.vcxproj.user
 39+Release