C++ Compiler Errors

C++ Compiler Errors

Post by metalkey on Wed Sep 23, 2015 4:45 am
([msg=89863]see C++ Compiler Errors[/msg])

I'm trying to compile https://www.exploit-db.com/exploits/37098/ to test on my WinXP VM but i'm getting the following compiler errors. Any ideas on how i can resolve these? Thanks!

root@kali:~/.wine/drive_c/MinGW/bin# wine g++ ex.cpp -o ex.exe
ex.h:9:20: error: typedef 'NTSTATUS' is initialized (use decltype instead)
typedef NTSTATUS ( WINAPI *_ZwAllocateVirtualMemory ) (
^
ex.h:9:20: error: expected primary-expression before '__attribute__'
typedef NTSTATUS ( WINAPI *_ZwAllocateVirtualMemory ) (
^
ex.h:18:20: error: typedef 'NTSTATUS' is initialized (use decltype instead)
typedef NTSTATUS ( WINAPI *_PsLookupProcessByProcessId ) (
^
ex.h:18:20: error: expected primary-expression before '__attribute__'
typedef NTSTATUS ( WINAPI *_PsLookupProcessByProcessId ) (
^
In file included from ex.cpp:14:0:
ex.h:24:5: warning: '__stdcall__' attribute only applies to function types [-Wattributes]
_Inout_ PVOID Process
^
ex.h:24:5: error: typedef '_PsReferencePrimaryToken' is initialized (use decltype instead)
ex.h:24:5: error: '_Inout_' was not declared in this scope
ex.h:32:20: error: typedef 'NTSTATUS' is initialized (use decltype instead)
typedef NTSTATUS ( WINAPI *_ZwQuerySystemInformation ) (
^
ex.h:32:20: error: expected primary-expression before '__attribute__'
typedef NTSTATUS ( WINAPI *_ZwQuerySystemInformation ) (
^
ex.cpp:16:1: error: '_ZwAllocateVirtualMemory' does not name a type
_ZwAllocateVirtualMemory ZwAllocateVirtualMemory;
^
ex.cpp:17:1: error: '_PsLookupProcessByProcessId' does not name a type
_PsLookupProcessByProcessId PsLookupProcessByProcessId;
^
ex.cpp:18:1: error: '_PsReferencePrimaryToken' does not name a type
_PsReferencePrimaryToken PsReferencePrimaryToken;
^
ex.cpp: In function 'DWORD_PTR pti()':
ex.cpp:29:47: error: '__readfsdword' was not declared in this scope
LPBYTE p = ( LPBYTE ) __readfsdword( 0x18 );
^
ex.cpp: In function 'BOOL Init()':
ex.cpp:67:5: error: '__try' was not declared in this scope
__try {
^
ex.cpp:67:11: error: expected ';' before '{' token
__try {
^
ex.cpp:286:1: error: expected '}' at end of input
}
^
metalkey
New User
New User
 
Posts: 2
Joined: Wed Sep 23, 2015 4:43 am
Blog: View Blog (0)


Re: C++ Compiler Errors

Post by pretentious on Fri Sep 25, 2015 8:02 am
([msg=89878]see Re: C++ Compiler Errors[/msg])

Code: Select all
root@kali:~/.wine/drive_c/MinGW/bin# wine g++ ex.cpp -o ex.exe

This amuses me :P I'm sure there is a good reason lol
To answer the question but also not really, Do you know C++?
Code: Select all
ex.cpp:286:1: error: expected '}' at end of input
}
^

Things like this.. Not to be a dick but in my experience, no amount of help will solve this if OP doesn't really know what they're doing.
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1203
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: C++ Compiler Errors

Post by metalkey on Sat Sep 26, 2015 5:03 am
([msg=89884]see Re: C++ Compiler Errors[/msg])

I only did a tiny bit of C++ a long, long time ago.
The actual code is here:
https://www.exploit-db.com/exploits/37098/

Are there any errors in the code that you can see?

-- Sun Sep 27, 2015 5:00 am --

Issue solved (not by myself) by using the Visual Studio Developer Command Line and compiling with the command "cl ex.cpp /link kernel32.lib shell32.lib user32.lib"
metalkey
New User
New User
 
Posts: 2
Joined: Wed Sep 23, 2015 4:43 am
Blog: View Blog (0)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests