Problem porting a Visual C++ 6 application to Visual C++ 2005

I'm trying to migrate a project made on Visual C++ 6 to Visual C++ 2005, but even with no compilation errors, the application don't work as the VC++ 6 project.

My application is a project about API Hook, and it's not working on Visual C++ 2005.

What can I do to maintain compatibility




Answer this question

Problem porting a Visual C++ 6 application to Visual C++ 2005

  • Frederic Feytons

    I've tryed using Step Into, but it stops from going ahead and don't capture API events, so the project stills stopped.

    If somebody can, download the project from CodeProject and try to debug it. If you need more information tell me, but I'm only starting to learn how to work with Visual C++ applications.



  • Greg Post-Graduate Eco Student

    And now Does anybody know what these errors mean

    I'm migrating the VC++ 6 project do VC++ .Net because on Visual C++ 6 its very hard to work with visual (MFC) applications. So I thought that would be easier on Visual Studio 2005 (VC++ 8).

    Thanks.



  • Bhasker

    But you still not describe which part of your code not working! What function you have that not working as expected and how is expected Does it work when compiled in VS6 If you want some good help - you must describe your problem with as much details as you can.


  • enetter

    Migrating from VC++ 6 to VC++ .NET is not simple as may looks like. You will have to rewrite much of code. .NET is not MFC and do not support MFC apps. It have different runtime, different memory management, different UI library... You will need to rewrite almost whole project.

  • Radu Poenaru

    Actually I'm using Visual Studio 2005 Professional to migrate the application.

    I have no compilation errors, so I don't know in which part of the code the error is. When compiled by VC++ 6, it runs without problem and when it detects another process initialization it stops it. But when compiled with VS 2005, I can run everything, because it doesn't intercepts the process start.



  • Jordan Flink

    Output Window:
    'protector.exe': Loaded 'D:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\Debug\protector.exe', Symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\SynTPFcs.dll', No symbols loaded.

    'protector.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.

    Is this the information you need



  • nidsu

    If your using Express, then it does not support MFC!

    Arnie


  • Phil Williams

    It's a MFC project...

    I got it here: http://www.codeproject.com/system/soviet_protector.asp



  • SValentine

    Hmm... No. I mean you have to locate some places that you are interested to check that they executed and add there Trace.WriteLine("check"). Then you will be able to read trace logs and see that your code was executed. For example of such places - when you register your driver (if I understand right - this project have driver), when driver receive IOCTL, when checks made - allow or not to run for new process, etc. Another way is to manually debug all this places and see that program works as expected, but debug will be harder task.

  • chris olsen

    I've changed the Project Properties, so now it's configured to use MFC libraries, and now I got this errors and warnings.

    Warning 1 warning C4996: 'strcpy' was declared deprecated d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 36

    Warning 2 warning C4996: 'stricmp' was declared deprecated d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 78

    Warning 3 warning C4996: 'strcpy' was declared deprecated d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 83

    Warning 4 warning C4996: 'strcat' was declared deprecated d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 84

    Warning 5 warning C4101: 'ps' : unreferenced local variable d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 245

    Warning 6 warning C4101: 'hdc' : unreferenced local variable d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\protector.cpp 246

    Error 7 error LNK2019: unresolved external symbol __imp__CloseServiceHandle@4 referenced in function "void __cdecl setup(void)" ( setup@@YAXXZ) protector.obj

    Error 8 error LNK2019: unresolved external symbol __imp__StartServiceA@12 referenced in function "void __cdecl setup(void)" ( setup@@YAXXZ) protector.obj

    Error 9 error LNK2019: unresolved external symbol __imp__CreateServiceA@52 referenced in function "void __cdecl setup(void)" ( setup@@YAXXZ) protector.obj

    Error 10 error LNK2019: unresolved external symbol __imp__OpenSCManagerA@12 referenced in function "void __cdecl setup(void)" ( setup@@YAXXZ) protector.obj

    Error 11 error LNK2019: unresolved external symbol __imp__DeleteService@4 referenced in function "void __cdecl cleanup(void)" ( cleanup@@YAXXZ) protector.obj

    Error 12 error LNK2019: unresolved external symbol __imp__ControlService@12 referenced in function "void __cdecl cleanup(void)" ( cleanup@@YAXXZ) protector.obj

    Error 13 error LNK2019: unresolved external symbol __imp__OpenServiceA@12 referenced in function "void __cdecl cleanup(void)" ( cleanup@@YAXXZ) protector.obj

    Error 14 error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "void __cdecl thread(void)" ( thread@@YAXXZ) protector.obj

    Error 15 error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16 protector.obj

    Error 16 error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16 protector.obj

    Error 17 error LNK2019: unresolved external symbol __imp__TranslateAcceleratorA@12 referenced in function _WinMain@16 protector.obj

    Error 18 error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16 protector.obj

    Error 19 error LNK2019: unresolved external symbol __imp__LoadAcceleratorsA@8 referenced in function _WinMain@16 protector.obj

    Error 20 error LNK2019: unresolved external symbol __imp__LoadStringA@16 referenced in function _WinMain@16 protector.obj

    Error 21 error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" ( MyRegisterClass@@YAGPAUHINSTANCE__@@@Z) protector.obj

    Error 22 error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" ( MyRegisterClass@@YAGPAUHINSTANCE__@@@Z) protector.obj

    Error 23 error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" ( MyRegisterClass@@YAGPAUHINSTANCE__@@@Z) protector.obj

    Error 24 error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" ( InitInstance@@YAHPAUHINSTANCE__@@H@Z) protector.obj

    Error 25 error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" ( InitInstance@@YAHPAUHINSTANCE__@@H@Z) protector.obj

    Error 26 error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" ( InitInstance@@YAHPAUHINSTANCE__@@H@Z) protector.obj

    Error 27 error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ( WndProc@@YGJPAUHWND__@@IIJ@Z) protector.obj

    Error 28 error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ( WndProc@@YGJPAUHWND__@@IIJ@Z) protector.obj

    Error 29 error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ( WndProc@@YGJPAUHWND__@@IIJ@Z) protector.obj

    Error 30 error LNK2019: unresolved external symbol __imp__DialogBoxParamA@20 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ( WndProc@@YGJPAUHWND__@@IIJ@Z) protector.obj

    Error 31 error LNK2019: unresolved external symbol __imp__EndDialog@8 referenced in function "long __stdcall About(struct HWND__ *,unsigned int,unsigned int,long)" ( About@@YGJPAUHWND__@@IIJ@Z) protector.obj

    Error 32 fatal error LNK1120: 25 unresolved externals d:\Escola\PIM 2006\Hooking the native API and controlling process creation on a system-wide basis_SOURCE\protector_app\protector\Debug\protector.exe 1



  • Rashmiaa

    Thanks Sergey! I didn't notice the no compilation errors hence I deleted my previous post.

    As you indicated, more details will be needed to diagnose the issue.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • MattyP

    So, does anyone know how can I do a Visual C++ 2005 application to work with API Hooking and prevent .EXE files execution

    Or with C#

    Anyone

    Thanks



  • psiegers

    Hi!

    You need to provide more information about your problem. Which library you use - MFC, ATL, WTL, STL... or clean Win32 API What function not working as you expected - post it here, so we can see it.


  • Freeweight

    Can you put trace to see that there is no errors happens during installation of this interceptor Perhabs it's never activated because it failed to register itself. The only way to get this problem caught - find where it started, trace it.

  • Problem porting a Visual C++ 6 application to Visual C++ 2005