VC++ types to ctypes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lux

    #1

    VC++ types to ctypes

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

    struct Soptions
    {
    char chVolumeLabel[128];
    __int32 nSessionToImpor t;
    BS_BOOL bJolietFileSyst em;
    BS_BOOL bBootable;
    TCHAR chBootImage[_MAX_PATH];
    BS_BOOL bFinalize;
    BS_BOOL bTestBurn;
    BS_BOOL bPerformOPC;
    BS_BOOL bVerifyAfterBur n;
    __int32 nCacheSize;
    BS_BOOL bUnderrunProtec tion;
    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

  • Thomas Heller

    #2
    Re: VC++ types to ctypes

    lux wrote:[color=blue]
    > Hi to all,
    > i need to traslate this struct in python using ctypes
    >
    > struct Soptions
    > {
    > char chVolumeLabel[128];
    > __int32 nSessionToImpor t;
    > BS_BOOL bJolietFileSyst em;
    > BS_BOOL bBootable;
    > TCHAR chBootImage[_MAX_PATH];
    > BS_BOOL bFinalize;
    > BS_BOOL bTestBurn;
    > BS_BOOL bPerformOPC;
    > BS_BOOL bVerifyAfterBur n;
    > __int32 nCacheSize;
    > BS_BOOL bUnderrunProtec tion;
    > 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
    >[/color]

    _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

    Comment

    • lux

      #3
      Re: VC++ types to ctypes

      Thank you now it work!!!


      Thomas Heller ha scritto:
      [color=blue]
      > lux wrote:[color=green]
      > > Hi to all,
      > > i need to traslate this struct in python using ctypes
      > >
      > > struct Soptions
      > > {
      > > char chVolumeLabel[128];
      > > __int32 nSessionToImpor t;
      > > BS_BOOL bJolietFileSyst em;
      > > BS_BOOL bBootable;
      > > TCHAR chBootImage[_MAX_PATH];
      > > BS_BOOL bFinalize;
      > > BS_BOOL bTestBurn;
      > > BS_BOOL bPerformOPC;
      > > BS_BOOL bVerifyAfterBur n;
      > > __int32 nCacheSize;
      > > BS_BOOL bUnderrunProtec tion;
      > > 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
      > >[/color]
      >
      > _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[/color]

      Comment

      Working...