Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2020-04-15 14:19:41 +0300
committerJan Vorlicek <janvorli@microsoft.com>2020-04-18 12:18:05 +0300
commitaec231da54ef8b45ebfb88cb9626cda0780261a7 (patch)
treefd1d969367ff41b01303a483ee35f61d083b2f2d /eng/native/genmoduleindex.cmd
parentcf66f084ca8b563c42cd814e8ce8b03519af51bd (diff)
Implement native GetModuleIndex
This change replaces managed GetModuleIndex tool by shell scripts using native tools.
Diffstat (limited to 'eng/native/genmoduleindex.cmd')
-rw-r--r--eng/native/genmoduleindex.cmd25
1 files changed, 25 insertions, 0 deletions
diff --git a/eng/native/genmoduleindex.cmd b/eng/native/genmoduleindex.cmd
new file mode 100644
index 00000000000..a6be851461a
--- /dev/null
+++ b/eng/native/genmoduleindex.cmd
@@ -0,0 +1,25 @@
+@echo off
+REM Generate module index header
+
+if [%1]==[] goto :Usage
+if [%2]==[] goto :Usage
+
+setlocal
+for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"size of image"') do set imagesize=%%i
+REM Pad the extracted size to 8 hex digits
+set imagesize=00000000%imagesize%
+set imagesize=%imagesize:~-8%
+
+for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"time date"') do set timestamp=%%i
+REM Pad the extracted time stamp to 8 hex digits
+set timestamp=00000000%timestamp%
+set timestamp=%timestamp:~-8%
+
+echo 0x08, 0x%timestamp:~6,2%, 0x%timestamp:~4,2%, 0x%timestamp:~2,2%, 0x%timestamp:~0,2%, 0x%imagesize:~6,2%, 0x%imagesize:~4,2%, 0x%imagesize:~2,2%, 0x%imagesize:~0,2%, > %2
+
+endlocal
+exit /b 0
+
+:Usage
+echo Usage: genmoduleindex.cmd ModuleBinaryFile IndexHeaderFile
+exit /b 1