VC++ types to ctypes

L

lux

Hi to all,
i need to traslate this struct in python using ctypes

struct Soptions
{
char chVolumeLabel[128];
__int32 nSessionToImport;
BS_BOOL bJolietFileSystem;
BS_BOOL bBootable;
TCHAR chBootImage[_MAX_PATH];
BS_BOOL bFinalize;
BS_BOOL bTestBurn;
BS_BOOL bPerformOPC;
BS_BOOL bVerifyAfterBurn;
__int32 nCacheSize;
BS_BOOL bUnderrunProtection;
BS_BOOL bEjectAfterBurn;
__int32 nCopies;
}

I try to convert:

char xxx[128] -> c_char*128
__int32 -> c_int
BS_BOOL -> c_byte

TCHAR chBootImage[_MAX_PATH]; -> ???

But not work...
how to solve it?

Thank's, Luca
 
T

Thomas Heller

lux said:
Hi to all,
i need to traslate this struct in python using ctypes

struct Soptions
{
char chVolumeLabel[128];
__int32 nSessionToImport;
BS_BOOL bJolietFileSystem;
BS_BOOL bBootable;
TCHAR chBootImage[_MAX_PATH];
BS_BOOL bFinalize;
BS_BOOL bTestBurn;
BS_BOOL bPerformOPC;
BS_BOOL bVerifyAfterBurn;
__int32 nCacheSize;
BS_BOOL bUnderrunProtection;
BS_BOOL bEjectAfterBurn;
__int32 nCopies;
}

I try to convert:

char xxx[128] -> c_char*128
__int32 -> c_int
BS_BOOL -> c_byte

TCHAR chBootImage[_MAX_PATH]; -> ???

But not work...
how to solve it?

Thank's, Luca

_MAX_PATH is 260.
TCHAR is normally a unicode (wide) or a ascii (ansi) character, depending
on if _UNICODE is defined by the compiler. Assuming ascii,
TCHAR chBootImage[_MAX_PATH] -> c_char * 260

Thomas
 
L

lux

Thank you now it work!!!


Thomas Heller ha scritto:
lux said:
Hi to all,
i need to traslate this struct in python using ctypes

struct Soptions
{
char chVolumeLabel[128];
__int32 nSessionToImport;
BS_BOOL bJolietFileSystem;
BS_BOOL bBootable;
TCHAR chBootImage[_MAX_PATH];
BS_BOOL bFinalize;
BS_BOOL bTestBurn;
BS_BOOL bPerformOPC;
BS_BOOL bVerifyAfterBurn;
__int32 nCacheSize;
BS_BOOL bUnderrunProtection;
BS_BOOL bEjectAfterBurn;
__int32 nCopies;
}

I try to convert:

char xxx[128] -> c_char*128
__int32 -> c_int
BS_BOOL -> c_byte

TCHAR chBootImage[_MAX_PATH]; -> ???

But not work...
how to solve it?

Thank's, Luca

_MAX_PATH is 260.
TCHAR is normally a unicode (wide) or a ascii (ansi) character, depending
on if _UNICODE is defined by the compiler. Assuming ascii,
TCHAR chBootImage[_MAX_PATH] -> c_char * 260

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top