From: Norman J. <nor...@ar...> - 2003-01-24 03:07:01
|
I checked the mingw/win32api header files against *other* ones and found out that they seem to be wrong : typedef struct tagRASCONNA { DWORD dwSize; HRASCONN hrasconn; CHAR szEntryName[RAS_MaxEntryName + 1]; CHAR szDeviceType[RAS_MaxDeviceType + 1]; CHAR szDeviceName[RAS_MaxDeviceName + 1]; #if (WINVER >= 0x401) CHAR szPhonebook[MAX_PATH]; DWORD dwSubEntry; #endif #if (WINVER >= 0x500) GUID guidEntry; #endif } RASCONNA, *LPRASCONNA; has to be typedef struct tagRASCONNA { DWORD dwSize; HRASCONN hrasconn; CHAR szEntryName[RAS_MaxEntryName + 1]; CHAR szDeviceType[RAS_MaxDeviceType + 1]; CHAR szDeviceName[RAS_MaxDeviceName + 1]; #if (WINVER >= 0x400) CHAR szDeviceType[ RAS_MaxDeviceType + 1 ]; CHAR szDeviceName[ RAS_MaxDeviceName + 1 ]; #endif #if (WINVER >= 0x401) CHAR szPhonebook [ MAX_PATH ]; DWORD dwSubEntry; #endif } RASCONNA, *LPRASCONNA; - otherwise the sizes do not match with the ones that certain functions expect ! If you want me to create a patch of this please tell me. Best regards, Norman ----- Original Message ----- From: "Norman Jonas" <nor...@we...> To: <min...@li...> Sent: Friday, January 24, 2003 3:48 AM Subject: Program does not runder when using certain WINVER > This little program lists all current RAS connections, but it does only work > without a defined WINVER. If the WINVER is defined > RasEnumConnections fails. I think that the reason is the wrong size of a > RASCONN struct when using the other WINVER so that > RasEnumConnections cannot determine its correct version ( which depends on > its dwSize member ). But to use this WINVER is > imported for me, because I have to use other functions that are only > available to higher versions ( I am running Win98 with IE 6.0 > so that I could even use WINVER >= 0x500 ). I will examine the problem by > myself, but any help is appreciated. > > // !!! #define WINVER 0x401 > > #include <stdio.h> > #include <conio.h> > #include <windows.h> > #include <ras.h> > > int main() > { > RASCONN connections[10]; > connections[0].dwSize = sizeof(RASCONN); > DWORD dwBuffersize = sizeof(RASCONN) * 10, dwConnections = 0; > > printf ( "Listing of RAS-connections :\n\n" ); > > if ( RasEnumConnections ( connections, &dwBuffersize, &dwConnections ) ) > { > printf ( "RasEnumConnections failed !\n" ); > } > else > { > for ( int i=0; i < dwConnections; i++ ) > { > printf ( "Connection : %s\n", connections[i].szEntryName ); > } > } > getch(); > } > |