VC6.0运行问题
#include<windows.h>#include<stdio.h>
#define DLL_NAME "user32.dll"
main()
{
BYTE* ptr;
int position, address;
HINSTANCE handle;
BOOL done_flag = FALSE;
handle = LoadLibrary(DLL_NAME);
if(!handle)
{
printf("load dll erro \n");
exit(0);
}
ptr = (BYTE*)handle;
for(position = 0; !done_flag; position++)
{
try
{
if(ptr == 0xFF && ptr == 0XE4)
{
int address = (int) ptr + position;
printf("opcode found at 0x%x\n", address);
}
}
catch(...)
{
int address = (int)ptr + position;
printf("end of 0x%x\n", address);
done_flag = true;
}
}
}
上面这段代码怎么在我的VC6运行就报错?大神快来救救孩子吧
vc60还没有淘汰吗 本帖最后由 jackz007 于 2021-3-17 11:33 编辑
用高版本 VC 编译器编译
下面是编译实况
【VC6(Visual Studio 6.0)】
D:\0002.Exercise\C\dll>cl x.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
x.c
x.c(20) : error C2065: 'try' : undeclared identifier
x.c(20) : error C2143: syntax error : missing ';' before '{'
x.c(27) : error C2143: syntax error : missing ')' before '...'
x.c(27) : error C2059: syntax error : ')'
x.c(31) : error C2065: 'true' : undeclared identifier
x.c(34) : error C2059: syntax error : '}'
D:\0002.Exercise\C\dll>
【VC16.8.2(Visual Studio 2019)】
D:\0002.Exercise\C>cl x.c
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.28.29334 版
版权所有(C) Microsoft Corporation。保留所有权利。
x.c
Microsoft (R) Incremental Linker Version 14.28.29334.0
Copyright (C) Microsoft Corporation.All rights reserved.
/out:x.exe
x.obj
D:\0002.Exercise\C> jackz007 发表于 2021-3-17 11:32
用高版本 VC 编译器编译
下面是编译实况
【VC6(Visual Studio 6.0)】
谢谢,已解决
页:
[1]