We help IT Professionals succeed at work.

How do i create a C++ application using wimgapi?

I have the wimgapi.dll file and the Microsoft Windows AIK installed on my development machine.

I have access to the wimgapi.h and the files that go with it.

I am working on an interface for a recovery disk using WinPE 3.0. Due to the lack of dot net support in WinPE I am programming using NetBeans in C++. I can link to the DLL and i can add the include statement to use the header file.

The only way i have gotten the include command to work is by having the header files in the root of the project directory and use the include command as follows #Include "WIMGAPI.h" to force it to look in the project folder. If i don't do this then it is unable to find the header file. Is there a way to get the include command to work without having to copy the files to the root of my project?

The main problem i am having is that after doing the above include command i am able to reference the commands within the header file but when i compile i get over 100 errors from the header file.


Here are some of the errors that i get.

wimgapi.h:200: warning: `__stdcall__' attribute only applies to function types

wimgapi.h:201: error: `__in' was not declared in this scope

wimgapi.h:202: error: `__in' was not declared in this scope

wimgapi.h:203: error: `__in' was not declared in this scope

wimgapi.h:204: error: `__in' was not declared in this scope

wimgapi.h:205: error: `__in' was not declared in this scope

wimgapi.h:206: error: `__out_opt' was not declared in this scope

wimgapi.h:207: error: initializer expression list treated as compound expression

wimgapi.h:211: warning: `__stdcall__' attribute only applies to function types


How can I compile my project and not receive all these complications or how can i modify the header file to work with C++?
Comment
Watch Question

Top Expert 2012
Commented:
BetBeans probably does not have the header files that #define __in etc. - since these are mainly descriptive than important, you can just use the following:
#define __in
#define __out
#define __out_opt
#include <wimgapi.h>

Open in new window

Author

Commented:
Thank you jkr that did resolve most of my errors and i think the rest my errors are related to this issue as well.
Now that i have defined all of those there are some that look like this in code.
WIMGetAttributes(
    __in                    HANDLE     hWim,
    __out_bcount(cbWimInfo) PWIM_INFO  pWimInfo,
    __in                    DWORD      cbWimInfo
    );

And is giving me the following errors.
wimgapi.h:274: error: expected identifier before '(' token
wimgapi.h:274: error: expected `,' or `...' before "PWIM_INFO"
wimgapi.h:276: error: ISO C++ forbids declaration of `cbWimInfo' with no type

Does this mean the define statement needs some form of variable definition?
jkr
Top Expert 2012
Commented:
That is some sort of a 'meta information' that the size of pWimInfo is contained in cbWimInfo, and an additional

#define __out_bcount(x)

Open in new window


should take care of that.
jkr
Top Expert 2012

Commented:
BTW, just to add that piece of info as well - these things that are causing you the trouble are actually MIDL instructions, the C++ compiler won't even 'see' them because of direcives similar to the ones I posted.

Author

Commented:
Thank you very much for your assistance jkr.