Delphi 启动应用程序时出现运行时错误 217(断言失败(C:\...\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas,第 1536 行)
Delphi Runtime Error 217 when application is started (Assertion failure (C:\...\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas, line 1536)
从 "TMS ComponentPack" 升级到 "TMS VCL UI Pack" 后,安装在 Windows 7 或 windows 8.1 上的应用程序在启动后崩溃,出现运行时错误 217 错误。
同一应用程序适用于 windows 10 或 windows 服务器 2012
使用 EurekaLog,我可以看到具体错误是在调用过程 LOADDLL
期间第 1536 行的 AdvXPVS.pas 断言失败
我无法调试应用程序,因为我的开发平台安装在 windows 10.
procedure LoadDLL;
begin
if DLLLoaded then Exit;
DLLHandle := LoadLibrary('UXTHEME.DLL');
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@OpenThemeDataForDpi := GetProcAddress(DLLHandle,'OpenThemeDataForDpi');
Assert(@OpenThemeDataForDpi <> nil);
//*********************************************************
// LINE 1536 START FROM HERE
//*********************************************************
@OpenThemeData := GetProcAddress(DLLHandle,'OpenThemeData');
Assert(@OpenThemeData <> nil);
@CloseThemeData := GetProcAddress(DLLHandle,'CloseThemeData');
Assert(@CloseThemeData <> nil);
@DrawThemeBackground := GetProcAddress(DLLHandle,'DrawThemeBackground');
Assert(@DrawThemeBackground <> nil);
...
...
@EnableTheming := GetProcAddress(DLLHandle,'EnableTheming');
Assert(@EnableTheming <> nil);
end
else
begin
DLLLoaded := False;
{ Error: UXTHEME.DLL could not be loaded !! }
end;
end;
汇编程序信息:
---------------------------------------------------------------------------
; Base Address: 12000, Allocation Base: 0000, Region Size: 10563584
; Allocation Protect: PAGE_EXECUTE_WRITECOPY, Protect: PAGE_EXECUTE_READ
; State: MEM_COMMIT, Type: MEM_IMAGE
;
;
; AdvXPVS.LoadDLL (Line=0 - Offset=33)
; ------------------------------------
01012459 8903 MOV [EBX], EAX
0101245B 833B20 CMP DWORD PTR [EBX],
0101245E 0F825F080000 JB +5F ; (012CC3) AdvXPVS.LoadDLL (Line=0)
01012464 C605CC26A60101 MOV BYTE PTR [A626CC], 1
0101246B 68E82C0101 PUSH 012CE8 ; (012CE8) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'O'; Data as UNICODE: 'OpenThemeDataFor...' AdvXPVS.LoadDLL (Line=0)
01012470 8B03 MOV EAX, [EBX]
01012472 50 PUSH EAX
01012473 E864DE40FF CALL -$BF219C ; ([=15=]4202DC) Winapi.GetProcAddress
01012478 8BF0 MOV ESI, EAX
0101247A 8935C844BA01 MOV [BA44C8], ESI
01012480 85F6 TEST ESI, ESI
01012482 7514 JNZ + ; (012498) AdvXPVS.LoadDLL (Line=0)
01012484 B900060000 MOV ECX, [=15=]000600
01012489 BA1C2D0101 MOV EDX, 012D1C ; (012D1C) AdvXPVS.LoadDLL (Line=0) UNICODE: 'C:\Users\Gianluca\Documents\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas' AdvXPVS.LoadDLL (Line=0)
0101248E B8B02D0101 MOV EAX, 012DB0 ; (012DB0) AdvXPVS.LoadDLL (Line=0) UNICODE: 'Assertion failure' AdvXPVS.LoadDLL (Line=0)
;
; Line=0 - Offset=91
; ------------------
01012493 E800A53FFF CALL -$C05B00 ; ([=15=]40C998) System._Assert ; <-- EXCEPTION
01012498 68D42D0101 PUSH 012DD4 ; (012DD4) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'O'; Data as UNICODE: 'OpenThemeData' AdvXPVS.LoadDLL (Line=0)
0101249D 8B03 MOV EAX, [EBX]
0101249F 50 PUSH EAX
010124A0 E837DE40FF CALL -$BF21C9 ; ([=15=]4202DC) Winapi.GetProcAddress
010124A5 8BF0 MOV ESI, EAX
010124A7 8935CC44BA01 MOV [BA44CC], ESI
010124AD 85F6 TEST ESI, ESI
010124AF 7514 JNZ + ; (0124C5) AdvXPVS.LoadDLL (Line=0)
010124B1 B903060000 MOV ECX, [=15=]000603
010124B6 BA1C2D0101 MOV EDX, 012D1C ; (012D1C) AdvXPVS.LoadDLL (Line=0) UNICODE: 'C:\Users\Gianluca\Documents\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas' AdvXPVS.LoadDLL (Line=0)
010124BB B8B02D0101 MOV EAX, 012DB0 ; (012DB0) AdvXPVS.LoadDLL (Line=0) UNICODE: 'Assertion failure' AdvXPVS.LoadDLL (Line=0)
010124C0 E8D3A43FFF CALL -$C05B2D ; ([=15=]40C998) System._Assert
010124C5 68F02D0101 PUSH 012DF0 ; (012DF0) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'C'; Data as UNICODE: 'CloseThemeData' AdvXPVS.LoadDLL (Line=0)
010124CA 8B03 MOV EAX, [EBX]
010124CC 50 PUSH EAX
010124CD E80ADE40FF CALL -$BF21F6 ; ([=15=]4202DC) Winapi.GetProcAddress
调用堆栈信息:
-------------------------------------------------------------------------------------------------------------------------------------
|Methods |Details|Stack |Address |Module |Offset |Source |Unit |Class|Procedure/Method |Line |
-------------------------------------------------------------------------------------------------------------------------------------
|*Exception Thread: ID=596; Parent=0; Priority=0 |
|Class=; Name=MAIN |
|DeadLock=0; Wait Chain= |
|Comment= |
|-----------------------------------------------------------------------------------------------------------------------------------|
|7FFFFFFE|03 |00000000|01012493|testxHairPlus.exe|00C12493|AdvXPVS.pas |AdvXPVS | |LoadDLL | |
|00000060|03 |0018FF34|019F4A28|testxHairPlus.exe|015F4A28|AdvXPVS.pas |AdvXPVS | |Initialization | |
|00000060|03 |0018FF3C|0040C512|testxHairPlus.exe|0000C512|System.pas |System | |InitUnits | |
|00000060|03 |0018FF60|0040C57B|testxHairPlus.exe|0000C57B|System.pas |System | |_StartExe | |
|00000020|03 |0018FF64|004147CE|testxHairPlus.exe|000147CE|SysInit.pas |SysInit | |_InitExe | |
|00004020|03 |0018FF6C|01A2435F|testxHairPlus.exe|0162435F|xHairPlus.pas|xHairPlus| |Initialization | |
|7FFF7FFE|03 |0018FF84|75027C02|kernel32.dll |00017C02|KERNEL32.DLL |KERNEL32 | |BaseThreadInitThunk| |
-------------------------------------------------------------------------------------------------------------------------------------
有时我们会收到行号减一的错误。在您的情况下,Assert(@OpenThemeDataForDpi <> nil);
失败,因为 OpenThemeDataForDpi
至少需要 Windows 10 1703。作为解决方法,您可以编写自己的版本,它只忽略 dpi
参数并调用标准 OpenThemeData
,然后当你得到 nil
指针时,将其设置为你的实现。
从 "TMS ComponentPack" 升级到 "TMS VCL UI Pack" 后,安装在 Windows 7 或 windows 8.1 上的应用程序在启动后崩溃,出现运行时错误 217 错误。
同一应用程序适用于 windows 10 或 windows 服务器 2012
使用 EurekaLog,我可以看到具体错误是在调用过程 LOADDLL
期间第 1536 行的 AdvXPVS.pas 断言失败我无法调试应用程序,因为我的开发平台安装在 windows 10.
procedure LoadDLL;
begin
if DLLLoaded then Exit;
DLLHandle := LoadLibrary('UXTHEME.DLL');
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@OpenThemeDataForDpi := GetProcAddress(DLLHandle,'OpenThemeDataForDpi');
Assert(@OpenThemeDataForDpi <> nil);
//*********************************************************
// LINE 1536 START FROM HERE
//*********************************************************
@OpenThemeData := GetProcAddress(DLLHandle,'OpenThemeData');
Assert(@OpenThemeData <> nil);
@CloseThemeData := GetProcAddress(DLLHandle,'CloseThemeData');
Assert(@CloseThemeData <> nil);
@DrawThemeBackground := GetProcAddress(DLLHandle,'DrawThemeBackground');
Assert(@DrawThemeBackground <> nil);
...
...
@EnableTheming := GetProcAddress(DLLHandle,'EnableTheming');
Assert(@EnableTheming <> nil);
end
else
begin
DLLLoaded := False;
{ Error: UXTHEME.DLL could not be loaded !! }
end;
end;
汇编程序信息:
---------------------------------------------------------------------------
; Base Address: 12000, Allocation Base: 0000, Region Size: 10563584
; Allocation Protect: PAGE_EXECUTE_WRITECOPY, Protect: PAGE_EXECUTE_READ
; State: MEM_COMMIT, Type: MEM_IMAGE
;
;
; AdvXPVS.LoadDLL (Line=0 - Offset=33)
; ------------------------------------
01012459 8903 MOV [EBX], EAX
0101245B 833B20 CMP DWORD PTR [EBX],
0101245E 0F825F080000 JB +5F ; (012CC3) AdvXPVS.LoadDLL (Line=0)
01012464 C605CC26A60101 MOV BYTE PTR [A626CC], 1
0101246B 68E82C0101 PUSH 012CE8 ; (012CE8) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'O'; Data as UNICODE: 'OpenThemeDataFor...' AdvXPVS.LoadDLL (Line=0)
01012470 8B03 MOV EAX, [EBX]
01012472 50 PUSH EAX
01012473 E864DE40FF CALL -$BF219C ; ([=15=]4202DC) Winapi.GetProcAddress
01012478 8BF0 MOV ESI, EAX
0101247A 8935C844BA01 MOV [BA44C8], ESI
01012480 85F6 TEST ESI, ESI
01012482 7514 JNZ + ; (012498) AdvXPVS.LoadDLL (Line=0)
01012484 B900060000 MOV ECX, [=15=]000600
01012489 BA1C2D0101 MOV EDX, 012D1C ; (012D1C) AdvXPVS.LoadDLL (Line=0) UNICODE: 'C:\Users\Gianluca\Documents\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas' AdvXPVS.LoadDLL (Line=0)
0101248E B8B02D0101 MOV EAX, 012DB0 ; (012DB0) AdvXPVS.LoadDLL (Line=0) UNICODE: 'Assertion failure' AdvXPVS.LoadDLL (Line=0)
;
; Line=0 - Offset=91
; ------------------
01012493 E800A53FFF CALL -$C05B00 ; ([=15=]40C998) System._Assert ; <-- EXCEPTION
01012498 68D42D0101 PUSH 012DD4 ; (012DD4) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'O'; Data as UNICODE: 'OpenThemeData' AdvXPVS.LoadDLL (Line=0)
0101249D 8B03 MOV EAX, [EBX]
0101249F 50 PUSH EAX
010124A0 E837DE40FF CALL -$BF21C9 ; ([=15=]4202DC) Winapi.GetProcAddress
010124A5 8BF0 MOV ESI, EAX
010124A7 8935CC44BA01 MOV [BA44CC], ESI
010124AD 85F6 TEST ESI, ESI
010124AF 7514 JNZ + ; (0124C5) AdvXPVS.LoadDLL (Line=0)
010124B1 B903060000 MOV ECX, [=15=]000603
010124B6 BA1C2D0101 MOV EDX, 012D1C ; (012D1C) AdvXPVS.LoadDLL (Line=0) UNICODE: 'C:\Users\Gianluca\Documents\tmssoftware\TMS VCL UI Pack\AdvXPVS.pas' AdvXPVS.LoadDLL (Line=0)
010124BB B8B02D0101 MOV EAX, 012DB0 ; (012DB0) AdvXPVS.LoadDLL (Line=0) UNICODE: 'Assertion failure' AdvXPVS.LoadDLL (Line=0)
010124C0 E8D3A43FFF CALL -$C05B2D ; ([=15=]40C998) System._Assert
010124C5 68F02D0101 PUSH 012DF0 ; (012DF0) AdvXPVS.LoadDLL (Line=0) Data as ANSI: 'C'; Data as UNICODE: 'CloseThemeData' AdvXPVS.LoadDLL (Line=0)
010124CA 8B03 MOV EAX, [EBX]
010124CC 50 PUSH EAX
010124CD E80ADE40FF CALL -$BF21F6 ; ([=15=]4202DC) Winapi.GetProcAddress
调用堆栈信息:
-------------------------------------------------------------------------------------------------------------------------------------
|Methods |Details|Stack |Address |Module |Offset |Source |Unit |Class|Procedure/Method |Line |
-------------------------------------------------------------------------------------------------------------------------------------
|*Exception Thread: ID=596; Parent=0; Priority=0 |
|Class=; Name=MAIN |
|DeadLock=0; Wait Chain= |
|Comment= |
|-----------------------------------------------------------------------------------------------------------------------------------|
|7FFFFFFE|03 |00000000|01012493|testxHairPlus.exe|00C12493|AdvXPVS.pas |AdvXPVS | |LoadDLL | |
|00000060|03 |0018FF34|019F4A28|testxHairPlus.exe|015F4A28|AdvXPVS.pas |AdvXPVS | |Initialization | |
|00000060|03 |0018FF3C|0040C512|testxHairPlus.exe|0000C512|System.pas |System | |InitUnits | |
|00000060|03 |0018FF60|0040C57B|testxHairPlus.exe|0000C57B|System.pas |System | |_StartExe | |
|00000020|03 |0018FF64|004147CE|testxHairPlus.exe|000147CE|SysInit.pas |SysInit | |_InitExe | |
|00004020|03 |0018FF6C|01A2435F|testxHairPlus.exe|0162435F|xHairPlus.pas|xHairPlus| |Initialization | |
|7FFF7FFE|03 |0018FF84|75027C02|kernel32.dll |00017C02|KERNEL32.DLL |KERNEL32 | |BaseThreadInitThunk| |
-------------------------------------------------------------------------------------------------------------------------------------
有时我们会收到行号减一的错误。在您的情况下,Assert(@OpenThemeDataForDpi <> nil);
失败,因为 OpenThemeDataForDpi
至少需要 Windows 10 1703。作为解决方法,您可以编写自己的版本,它只忽略 dpi
参数并调用标准 OpenThemeData
,然后当你得到 nil
指针时,将其设置为你的实现。