bindexplib: Build source as part of CMakeLib

This commit is contained in:
Bill Hoffman 2015-06-19 16:12:43 -04:00 committed by Brad King
parent 2963cb2a55
commit 8ea69dfef1
2 changed files with 8 additions and 4 deletions

View File

@ -430,6 +430,7 @@ if (WIN32)
set(SRCS ${SRCS} set(SRCS ${SRCS}
cmCallVisualStudioMacro.cxx cmCallVisualStudioMacro.cxx
cmCallVisualStudioMacro.h cmCallVisualStudioMacro.h
bindexplib.cxx
) )
if(NOT UNIX) if(NOT UNIX)

View File

@ -71,10 +71,12 @@
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
#include <cmsys/Encoding.hxx>
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <fstream> #include <fstream>
#include <iostream>
/* /*
+ * Utility func, strstr with size + * Utility func, strstr with size
@ -89,7 +91,7 @@ const char* StrNStr(const char* start, const char* find, size_t &size) {
} }
len = strlen(find); len = strlen(find);
while (hint = (const char*) memchr(start, find[0], size-len+1)) { while ((hint = (const char*) memchr(start, find[0], size-len+1))) {
size -= (hint - start); size -= (hint - start);
if (!strncmp(hint, find, len)) if (!strncmp(hint, find, len))
return hint; return hint;
@ -169,7 +171,7 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader,
void void
DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable,
PIMAGE_SECTION_HEADER pSectionHeaders, PIMAGE_SECTION_HEADER pSectionHeaders,
FILE *fout, unsigned cSymbols) FILE *fout, DWORD_PTR cSymbols)
{ {
unsigned i; unsigned i;
PSTR stringTable; PSTR stringTable;
@ -295,14 +297,15 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout)
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
void void
DumpFile(LPSTR filename, FILE *fout) DumpFile(const char* filename, FILE *fout)
{ {
HANDLE hFile; HANDLE hFile;
HANDLE hFileMapping; HANDLE hFileMapping;
LPVOID lpFileBase; LPVOID lpFileBase;
PIMAGE_DOS_HEADER dosHeader; PIMAGE_DOS_HEADER dosHeader;
hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(),
GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {