Skip to content

Commit

Permalink
* build phobos browse info: operated on outdated folder structure of …
Browse files Browse the repository at this point in the history
…phobos/druntime

* DMD/x64 linker override settings not saved
* revamped pipedmd: now uses tracker.exe from MSBuild or WinSDK to monitor dependencies
* moved registry helper functions to stdext.registry
  • Loading branch information
rainers committed Dec 19, 2014
1 parent c7d5b14 commit 53d5bd8
Show file tree
Hide file tree
Showing 12 changed files with 978 additions and 554 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -686,3 +686,6 @@ unreleased Version 0.3.40
* really updated dparser to a6207d6db5e54c68aa4b9db53b702681242d81d5
* goto definition on import now supports package.d
* bugzilla 13759: $(VSINSTALLDIR)\Common7\IDE now added to the default executable paths
* build phobos browse info: operated on outdated folder structure of phobos/druntime
* DMD/x64 linker override settings not saved
* revamped pipedmd: now uses tracker.exe from MSBuild or WinSDK to monitor dependencies
3 changes: 1 addition & 2 deletions Makefile
Expand Up @@ -163,8 +163,7 @@ install: all cpp2d_exe idl2d_exe
cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi
"$(ZIP)" -j ..\downloads\visuald_pdb.zip bin\release\visuald.pdb bin\release\vdserver.pdb

#prerequisites
install_vs: visuald_vs vdserver cv2pdb dparser vdextension mago install_only
install_vs: prerequisites visuald_vs vdserver cv2pdb dparser vdextension mago install_only

install_only:
cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi
Expand Down
5 changes: 4 additions & 1 deletion TODO
Expand Up @@ -33,7 +33,7 @@ Project:
- GDC:
- separate compile + link does not write to object dir
- ddoc files
- additional options for resource compiler
+ additional options for resource compiler
- pass import path from static lib project to dependent projects
- single file compilation for file configuration
- custom command: quotes in dependencies not supported
Expand Down Expand Up @@ -167,3 +167,6 @@ Unsorted
- jump to assertion error
+ import std.container: jump to package
- renaming configuration does not change project config
- win32coff support
- file search: replace . with \ in path search?
- run cv2pdb disabled for GDC/x64
6 changes: 5 additions & 1 deletion build/build.visualdproj
Expand Up @@ -49,6 +49,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
<imppath />
<fileImppath />
Expand Down Expand Up @@ -147,6 +149,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
<imppath />
<fileImppath />
Expand Down Expand Up @@ -201,7 +205,7 @@ echo. &gt;$(TargetDir)\build.dep</postBuildCommand>
<File tool="Custom" path="dte_idl.bat" dependencies="$(OutDir)\tlb2idl.exe" customcmd="call &quot;$(VSINSTALLDIR)\Common7\Tools\vsvars32.bat&quot;
if errorlevel 1 goto reportError
call $(InputPath) &quot;$(OutDir)\tlb2idl.exe&quot; &quot;$(OutDir)\dte_idl.success&quot;" outfile="$(OutDir)\dte_idl.success" />
<File tool="Custom" path="..\tools\filemonitor.d" customcmd="dmd -map $(OutDir)\$(InputName).map -of$(OutDir)\$(InputName).dll -defaultlib=user32.lib -L/ENTRY:_DllMain@12 $(InputPath)" outfile="$(OutDir)\$(InputName).dll" />
<File tool="Custom" path="..\tools\filemonitor.d" customcmd="dmd -g -map $(OutDir)\$(InputName).map -of$(OutDir)\$(InputName).dll -defaultlib=user32.lib -L/ENTRY:_DllMain@12 $(InputPath)" outfile="$(OutDir)\$(InputName).dll" />
<File tool="Custom" path="..\tools\largeadr.d" customcmd="dmd -map $(OutDir)\$(InputName).map -of$(OutDir)\$(InputName).exe $(InputPath)" outfile="$(OutDir)\$(InputName).exe" />
<File tool="Custom" path="..\tools\pipedmd.d" dependencies="..\tools\nostacktrace.d" customcmd="dmd -map $(OutDir)\$(InputName).map -of$(OutDir)\$(InputName).exe $(InputPath) ..\tools\nostacktrace.d" outfile="$(OutDir)\$(InputName).exe" />
<File tool="Custom" path="sdk.bat" dependencies="$(OutDir)\dte_idl.success $(OutDir)\vsi2d.exe" customcmd="call &quot;$(VSINSTALLDIR)\Common7\Tools\vsvars32.bat&quot;
Expand Down
125 changes: 125 additions & 0 deletions stdext/registry.d
@@ -0,0 +1,125 @@
module stdext.registry;

import stdext.com;

import sdk.win32.winreg;
import sdk.port.base;

enum { SECURE_ACCESS = ~(WRITE_DAC | WRITE_OWNER | GENERIC_ALL | ACCESS_SYSTEM_SECURITY) }

/*---------------------------------------------------------
Registry helpers
-----------------------------------------------------------*/
HRESULT RegQueryValue(HKEY root, in wstring keyname, in wstring valuename, ref wstring value)
{
HKEY key;
HRESULT hr = hrRegOpenKeyEx(root, keyname, 0, KEY_READ, &key);
if(FAILED(hr))
return hr;
scope(exit) RegCloseKey(key);

wchar[260] buf;
DWORD cnt = 260 * wchar.sizeof;
wchar* szName = _toUTF16zw(valuename);
DWORD type;
hr = RegQueryValueExW(key, szName, null, &type, cast(ubyte*) buf.ptr, &cnt);
if(hr == S_OK && cnt > 0)
value = to_wstring(buf.ptr);
if(hr != ERROR_MORE_DATA)
return HRESULT_FROM_WIN32(hr);
if (type != REG_SZ)
return ERROR_DATATYPE_MISMATCH;

scope wchar[] pbuf = new wchar[cnt/2 + 1];
hr = RegQueryValueExW(key, szName, null, &type, cast(ubyte*) pbuf.ptr, &cnt);
if(hr == S_OK)
value = to_wstring(pbuf.ptr);
return HRESULT_FROM_WIN32(hr);
}

HRESULT RegCreateValue(HKEY key, in wstring name, in wstring value)
{
wstring szName = name ~ cast(wchar)0;
wstring szValue = value ~ cast(wchar)0;
DWORD dwDataSize = value is null ? 0 : wchar.sizeof * (value.length+1);
LONG lRetCode = RegSetValueExW(key, szName.ptr, 0, REG_SZ, cast(ubyte*)(szValue.ptr), dwDataSize);
return HRESULT_FROM_WIN32(lRetCode);
}

HRESULT RegCreateDwordValue(HKEY key, in wstring name, in DWORD value)
{
wstring szName = name ~ cast(wchar)0;
LONG lRetCode = RegSetValueExW(key, szName.ptr, 0, REG_DWORD, cast(ubyte*)(&value), value.sizeof);
return HRESULT_FROM_WIN32(lRetCode);
}

HRESULT RegCreateQwordValue(HKEY key, in wstring name, in long value)
{
wstring szName = name ~ cast(wchar)0;
LONG lRetCode = RegSetValueExW(key, szName.ptr, 0, REG_QWORD, cast(ubyte*)(&value), value.sizeof);
return HRESULT_FROM_WIN32(lRetCode);
}

HRESULT RegCreateBinaryValue(HKEY key, in wstring name, in void[] data)
{
wstring szName = name ~ cast(wchar)0;
LONG lRetCode = RegSetValueExW(key, szName.ptr, 0, REG_BINARY, cast(ubyte*)data.ptr, data.length);
return HRESULT_FROM_WIN32(lRetCode);
}

HRESULT RegDeleteRecursive(HKEY keyRoot, wstring path)
{
HRESULT hr;
HKEY key;
ULONG subKeys = 0;
ULONG maxKeyLen = 0;
ULONG currentKey = 0;
wstring[] keyNames;

hr = hrRegOpenKeyEx(keyRoot, path, 0, (KEY_READ & SECURE_ACCESS), &key);
if (!FAILED(hr))
{
LONG lRetCode = RegQueryInfoKeyW(key, null, null, null, &subKeys, &maxKeyLen,
null, null, null, null, null, null);
if (ERROR_SUCCESS != lRetCode)
{
hr = HRESULT_FROM_WIN32(lRetCode);
}
else if (subKeys > 0)
{
wchar[] keyName = new wchar[maxKeyLen+1];
for (currentKey = 0; currentKey < subKeys; currentKey++)
{
ULONG keyLen = maxKeyLen+1;
lRetCode = RegEnumKeyExW(key, currentKey, keyName.ptr, &keyLen, null, null, null, null);
if (ERROR_SUCCESS == lRetCode)
keyNames ~= to_wstring(keyName.ptr, keyLen);
}
foreach(wstring subkey; keyNames)
RegDeleteRecursive(key, subkey);
}
}
fail:
wstring szPath = path ~ cast(wchar)0;
LONG lRetCode = RegDeleteKeyW(keyRoot, szPath.ptr);
if (SUCCEEDED(hr) && (ERROR_SUCCESS != lRetCode))
hr = HRESULT_FROM_WIN32(lRetCode);
if (key) RegCloseKey(key);
return hr;
}

HRESULT hrRegOpenKeyEx(HKEY root, wstring regPath, int reserved, REGSAM samDesired, HKEY* phkResult)
{
wchar* szRegPath = _toUTF16zw(regPath);
LONG lRes = RegOpenKeyExW(root, szRegPath, 0, samDesired, phkResult);
return HRESULT_FROM_WIN32(lRes);
}

HRESULT hrRegCreateKeyEx(HKEY keySub, wstring regPath, int reserved, wstring classname, DWORD opt, DWORD samDesired,
SECURITY_ATTRIBUTES* security, HKEY* key, DWORD* disposition)
{
wchar* szRegPath = _toUTF16zw(regPath);
wchar* szClassname = _toUTF16zw(classname);
LONG lRes = RegCreateKeyExW(keySub, szRegPath, 0, szClassname, opt, samDesired, security, key, disposition);
return HRESULT_FROM_WIN32(lRes);
}
37 changes: 37 additions & 0 deletions stdext/stdext.visualdproj
Expand Up @@ -12,6 +12,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>0</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -48,6 +49,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -109,6 +112,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>0</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -145,6 +149,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -206,6 +212,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -242,6 +249,8 @@
<stackStomp>0</stackStomp>
<compiler>1</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>&quot;c:\u\MinGW\msys\1.0\bin\sh.exe&quot; -c &quot;gdmd&quot;</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -303,6 +312,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -339,6 +349,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -400,6 +412,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>0</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -436,6 +449,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>1</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath />
<fileImppath />
Expand Down Expand Up @@ -497,6 +512,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -533,6 +549,8 @@
<stackStomp>0</stackStomp>
<compiler>1</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>&quot;c:\u\MinGW\msys\1.0\bin\sh.exe&quot; -c &quot;gdmd&quot;</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -594,6 +612,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>0</symdebug>
<optimize>1</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -630,6 +649,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -691,6 +712,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>0</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -727,6 +749,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -788,6 +812,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -824,6 +849,8 @@
<stackStomp>0</stackStomp>
<compiler>2</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>&quot;c:\u\MinGW\msys\1.0\bin\sh.exe&quot; -c &quot;gdmd&quot;</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -885,6 +912,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -921,6 +949,8 @@
<stackStomp>0</stackStomp>
<compiler>2</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>&quot;c:\u\MinGW\msys\1.0\bin\sh.exe&quot; -c &quot;gdmd&quot;</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -982,6 +1012,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -1018,6 +1049,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -1079,6 +1112,7 @@
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<vgc>0</vgc>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
Expand Down Expand Up @@ -1115,6 +1149,8 @@
<stackStomp>0</stackStomp>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<cccmd>$(CC) -c</cccmd>
<ccTransOpt>1</ccTransOpt>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -1172,6 +1208,7 @@
<File path="file.d" />
<File path="httpget.d" />
<File path="path.d" />
<File path="registry.d" />
<File path="string.d" />
<File path="util.d" />
</Folder>
Expand Down

0 comments on commit 53d5bd8

Please sign in to comment.