Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | no message |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
29ec851a720b2c3fc59144212335e41d |
User & Date: | rmsimpson 2006-01-23 05:16:20.000 |
Context
2006-01-23
| ||
19:41 | no message check-in: 46a5ce61ca user: rmsimpson tags: sourceforge | |
05:16 | no message check-in: 29ec851a72 user: rmsimpson tags: sourceforge | |
05:15 | Build changes check-in: bd756986ce user: rmsimpson tags: sourceforge | |
Changes
Added SQLite.Interop/Lib/arm/mscoree.def.
> > > | 1 2 3 | LIBRARY MSCOREE EXPORTS _CorDllMain |
Added SQLite.Interop/Lib/arm/mscoree.lib.
cannot compute difference between binary files
Changes to System.Data.SQLite/System.Data.SQLite.
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <OutputPath>..\bin\</OutputPath> <DefineConstants>TRACE;DEBUG;USE_INTEROP_DLL</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DocumentationFile> </DocumentationFile> <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> | > > > > > > > > > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <OutputPath>..\bin\</OutputPath> <DefineConstants>TRACE;DEBUG;USE_INTEROP_DLL</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DocumentationFile> </DocumentationFile> <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\</OutputPath> <DefineConstants> </DefineConstants> <DebugType>full</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> <CodeAnalysisRuleAssemblies>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <ErrorReport>prompt</ErrorReport> <FileAlignment>512</FileAlignment> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 | Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> <PropertyGroup> </PropertyGroup> </Project> | > | 105 106 107 108 109 110 111 112 113 114 | Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> <PropertyGroup> <PostBuildEvent>"$(SolutionDir)bin\tools\mergebin.exe" /p:"$(TargetPath)" >"$(SolutionDir)SQLite.Interop\merge_full.h"</PostBuildEvent> </PropertyGroup> </Project> |
Changes to tools/mergebin/PEFile.cpp.
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | else { if (m_pNTHeader->Signature != IMAGE_NT_SIGNATURE) { hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); } } } if (FAILED(hr)) Close(); return hr; } | > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | else { if (m_pNTHeader->Signature != IMAGE_NT_SIGNATURE) { hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); } } m_bIs64Bit = (m_pNTHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC); } if (FAILED(hr)) Close(); return hr; } |
︙ | ︙ | |||
92 93 94 95 96 97 98 | m_hMap = NULL; m_hFile = INVALID_HANDLE_VALUE; m_pBase = NULL; } PIMAGE_SECTION_HEADER CPEFile::GetEnclosingSectionHeader(DWORD rva) const { | | > > > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | m_hMap = NULL; m_hFile = INVALID_HANDLE_VALUE; m_pBase = NULL; } PIMAGE_SECTION_HEADER CPEFile::GetEnclosingSectionHeader(DWORD rva) const { PIMAGE_SECTION_HEADER section; if (m_bIs64Bit) section = IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS64)m_pNTHeader); else section = IMAGE_FIRST_SECTION(m_pNTHeader); for (UINT i=0; i < m_pNTHeader->FileHeader.NumberOfSections; i++, section++ ) { DWORD size = section->Misc.VirtualSize; if (!size) size = section->SizeOfRawData; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | delta = (INT)(pSectionHdr->VirtualAddress-pSectionHdr->PointerToRawData); return (PVOID) (((LPBYTE)m_pBase) + rva - delta); } PIMAGE_SECTION_HEADER CPEFile::GetSectionHeader(LPCSTR name) const { | | > > > > > | | > > > > > > > > > > | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | delta = (INT)(pSectionHdr->VirtualAddress-pSectionHdr->PointerToRawData); return (PVOID) (((LPBYTE)m_pBase) + rva - delta); } PIMAGE_SECTION_HEADER CPEFile::GetSectionHeader(LPCSTR name) const { PIMAGE_SECTION_HEADER section; if (m_bIs64Bit) section = IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS64)m_pNTHeader); else section = IMAGE_FIRST_SECTION(m_pNTHeader); for (UINT i=0; i < m_pNTHeader->FileHeader.NumberOfSections; i++, section++) { if (_strnicmp((char *)section->Name,name,IMAGE_SIZEOF_SHORT_NAME) == 0) return section; } return NULL; } CPEFile::operator PIMAGE_NT_HEADERS32() const { if (!m_pBase || m_bIs64Bit) return NULL; return m_pNTHeader; } CPEFile::operator PIMAGE_NT_HEADERS64() const { if (!m_pBase || !m_bIs64Bit) return NULL; return (PIMAGE_NT_HEADERS64)m_pNTHeader; } CPEFile::operator PIMAGE_DOS_HEADER() const { return m_pBase; } CPEFile::operator PIMAGE_COR20_HEADER() const { if (!m_pBase) return NULL; DWORD dwRVA; if (m_bIs64Bit) dwRVA = ((PIMAGE_NT_HEADERS64)m_pNTHeader)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; else dwRVA = m_pNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; if (!dwRVA) { return NULL; } return ((PIMAGE_COR20_HEADER)GetPtrFromRVA(dwRVA)); } |
Changes to tools/mergebin/PEFile.h.
︙ | ︙ | |||
10 11 12 13 14 15 16 | class CPEFile { public: CPEFile(); virtual ~CPEFile(void); protected: | | | | | > | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | class CPEFile { public: CPEFile(); virtual ~CPEFile(void); protected: HANDLE m_hMap; HANDLE m_hFile; PIMAGE_DOS_HEADER m_pBase; PIMAGE_NT_HEADERS32 m_pNTHeader; BOOL m_bIs64Bit; public: HRESULT Open (LPCTSTR pszFile, BOOL bReadOnly = TRUE); void Close (void); PIMAGE_SECTION_HEADER GetEnclosingSectionHeader (DWORD rva) const; LPVOID GetPtrFromRVA (DWORD rva) const; PIMAGE_SECTION_HEADER GetSectionHeader (LPCSTR name) const; operator PIMAGE_DOS_HEADER () const; operator PIMAGE_NT_HEADERS32 () const; operator PIMAGE_NT_HEADERS64 () const; operator PIMAGE_COR20_HEADER () const; }; |
Changes to tools/mergebin/mergebin.cpp.
︙ | ︙ | |||
199 200 201 202 203 204 205 | _tprintf(_T("// This code was automatically generated from assembly\n\ // %s\n\n\ #include <windef.h>\n\n\ #pragma data_seg(\"%s\")\n\ #pragma comment(linker, \"/SECTION:%s,ER\")\n\ char __ph[%d] = {0}; // The number of bytes to reserve\n\ #pragma data_seg()\n\n\ | | | > > > > > > > | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | _tprintf(_T("// This code was automatically generated from assembly\n\ // %s\n\n\ #include <windef.h>\n\n\ #pragma data_seg(\"%s\")\n\ #pragma comment(linker, \"/SECTION:%s,ER\")\n\ char __ph[%d] = {0}; // The number of bytes to reserve\n\ #pragma data_seg()\n\n\ typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);\n\ extern BOOL WINAPI _DllMainCRTStartup(HANDLE, DWORD, LPVOID);\n\n\ __declspec(dllexport) BOOL WINAPI _CorDllMainStub(HANDLE hModule, DWORD dwReason, LPVOID pvReserved)\n\ {\n\ HANDLE hMod;\n\ DLLMAIN proc;\n\n\ hMod = GetModuleHandle(_T(\"mscoree\"));\n\ if (hMod)\n\ proc = (DLLMAIN)GetProcAddress(hMod, _T(\"_CorDllMain\"));\n\ else\n\ proc = _DllMainCRTStartup;\n\n\ return proc(hModule, dwReason, pvReserved);\n\ }\n\ "), pszAssembly, pszSection, pszSection, (dwMaxRVA - dwMinRVA) + ((PIMAGE_COR20_HEADER)peFile)->cb); } /* When merged, the native DLL's entrypoint must go to _CorDllMain in MSCOREE.DLL. ** In order to do this, we need to change the DLL's entrypoint to "something" that will ** call CorDllMain. Since its too much hassle to add imports to the DLL and make drastic |
︙ | ︙ | |||
227 228 229 230 231 232 233 | DWORD i; DWORD *pdwFunctions; PWORD pwOrdinals; DWORD *pszFuncNames; DWORD exportsStartRVA; DWORD exportsEndRVA; CHAR szName[MAX_PATH + 1]; | | > > > | | > > > > > > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | DWORD i; DWORD *pdwFunctions; PWORD pwOrdinals; DWORD *pszFuncNames; DWORD exportsStartRVA; DWORD exportsEndRVA; CHAR szName[MAX_PATH + 1]; PIMAGE_NT_HEADERS32 pNT = file; PIMAGE_NT_HEADERS64 pNT64 = file; if (pNT) { exportsStartRVA = pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; exportsEndRVA = exportsStartRVA + pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; } else { exportsStartRVA = pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; exportsEndRVA = exportsStartRVA + pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; } header = file.GetEnclosingSectionHeader(exportsStartRVA); if (!header) return 0; delta = (INT)(header->VirtualAddress - header->PointerToRawData); |
︙ | ︙ | |||
279 280 281 282 283 284 285 | DWORD dwDestRVA; PIMAGE_SECTION_HEADER pSection; LPBYTE pSrc; LPBYTE pDest; DWORD dwSize; DWORD dwNewEntrypoint; PIMAGE_COR20_HEADER pCor; | > | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | DWORD dwDestRVA; PIMAGE_SECTION_HEADER pSection; LPBYTE pSrc; LPBYTE pDest; DWORD dwSize; DWORD dwNewEntrypoint; PIMAGE_COR20_HEADER pCor; PIMAGE_NT_HEADERS32 pNT; PIMAGE_NT_HEADERS64 pNT64; int diffRVA; CTableData *p; DWORD *pdwRVA; DWORD dwRows; // Open the .NET assembly hr = peFile.Open(pszAssembly); |
︙ | ︙ | |||
338 339 340 341 342 343 344 | // If the native DLL has been merged with an assembly beforehand, we need to strip the .NET stuff and restore the entrypoint pCor = peDest; if (pCor) { if (pCor->Flags & 0x10) { pNT = peDest; | > > > | > > > > > > > | | > > > > > > < > > | | | | > > > > > > > > > | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | // If the native DLL has been merged with an assembly beforehand, we need to strip the .NET stuff and restore the entrypoint pCor = peDest; if (pCor) { if (pCor->Flags & 0x10) { pNT = peDest; pNT64 = peDest; if (pNT) pNT->OptionalHeader.AddressOfEntryPoint = pCor->EntryPointToken; else pNT64->OptionalHeader.AddressOfEntryPoint = pCor->EntryPointToken; } } // Copy the assembly's .NET header into the section dwSize = ((PIMAGE_COR20_HEADER)peFile)->cb; pSrc = (LPBYTE)(PIMAGE_COR20_HEADER)peFile; pDest = (LPBYTE)peDest.GetPtrFromRVA(dwDestRVA); CopyMemory(pDest, pSrc, dwSize); pNT = peDest; pNT64 = peDest; // Fixup the NT header on the native DLL to include the new .NET header if (pNT) { pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress = pSection->VirtualAddress; pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size = dwSize; } else { pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress = pSection->VirtualAddress; pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size = dwSize; } dwDestRVA += dwSize; if (dwDestRVA % 4) dwDestRVA += (4 - (dwDestRVA % 4)); // Copy the .NET block of code and metadata into the section, after the header dwSize = dwMaxRVA - dwMinRVA; pSrc = (LPBYTE)peFile.GetPtrFromRVA(dwMinRVA); pDest = (LPBYTE)peDest.GetPtrFromRVA(dwDestRVA); CopyMemory(pDest, pSrc, dwSize); // Figure out by how much we need to change the RVA's to compensate for the relocation diffRVA = dwDestRVA - dwMinRVA; pCor = peDest; // Fixup the DLL entrypoints if (pNT) { if (pNT->OptionalHeader.AddressOfEntryPoint != dwNewEntrypoint) { pCor->EntryPointToken = pNT->OptionalHeader.AddressOfEntryPoint; pNT->OptionalHeader.AddressOfEntryPoint = dwNewEntrypoint; } } else { if (pNT64->OptionalHeader.AddressOfEntryPoint != dwNewEntrypoint) { pCor->EntryPointToken = pNT64->OptionalHeader.AddressOfEntryPoint; pNT64->OptionalHeader.AddressOfEntryPoint = dwNewEntrypoint; } } // Adjust the .NET headers to indicate we're a mixed DLL pCor->Flags = (pCor->Flags & 0xFFFE) | 0x10; // Fixup the metadata header RVA's if (pCor->MetaData.VirtualAddress) pCor->MetaData.VirtualAddress += diffRVA; if (pCor->Resources.VirtualAddress) pCor->Resources.VirtualAddress += diffRVA; |
︙ | ︙ | |||
402 403 404 405 406 407 408 | pdwRVA = (DWORD *)p->Column(uRow, (UINT)0); if (*pdwRVA) *pdwRVA = (*pdwRVA) + diffRVA; } } } | | | > > | > | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | pdwRVA = (DWORD *)p->Column(uRow, (UINT)0); if (*pdwRVA) *pdwRVA = (*pdwRVA) + diffRVA; } } } // If this is a CE file, then change the processor to x86 if (pNT) { if (pNT->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CE_GUI) pNT->FileHeader.Machine = IMAGE_FILE_MACHINE_I386; } if (pCor->Flags & 0x08) _tprintf(_T("WARNING: %s must be re-signed before it can be used!\n"), pszNative); _tprintf(_T("Success!\n")); } |