Windows header files lazarus / 21-General ---------------------------------------------------------------------- engine32 · 2022-09-25 17:11 Hello,   How people using Lazarus are dealing with Windows header files ? I have hard time to find them.   In particular, Microsoft says "The WSAID_MULTIPLE_RIO GUID is defined in the Mswsock.h header file."   After much search, I found one header file that does not contain this define. I see for example: Quote#define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} but not WSAID_MULTIPLE_RIO GUID .   I found a piece of code online with the following: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i               WSAID_MULTIPLE_RIO := &windows.GUID{0x8509e081, 0x96dd, 0x4005, [8]byte{0xb1, 0x65, 0x9e, 0x2e, 0xe8, 0xc7, 0x9e, 0x3f}}              const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER = 0xc8000024              ob := uint32(0)                err = windows.WSAIoctl(socket, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER,                        (*byte)(unsafe.Pointer(WSAID_MULTIPLE_RIO)), uint32(unsafe.Sizeof(*WSAID_MULTIPLE_RIO)),                        (*byte)(unsafe.Pointer(&extensionFunctionTable)), uint32(unsafe.Sizeof(extensionFunctionTable)),                        &ob, nil, 0)  I created the constants like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   IOC_IN = $80000000;  IOC_OUT = $40000000;  IOC_INOUT = IOC_IN or IOC_OUT;  IOC_WS2 = $08000000;  SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER = IOC_INOUT or IOC_WS2 or 36; // 3355443236; // $C8 00 00 24  WSAID_MULTIPLE_RIO: array [0..15] of byte = ($85, $09, $e0, $81, + $96, + $dd, $40, $05, $b1, $65, $9e, $2e, $e8, $c7, $9e, $3f); // 0x8509e08196dd4005b1659e2ee8c79e3f;  WSA_FLAG_REGISTERED_IO_BP = 8; run WSASocketW which returns a valid socket handle. However, WSAIoctl returns -1, and subsequent WSAGetLastError zero.   So, here I am, don't know how to go further. ---------------------------------------------------------------------- KodeZwerg · 2022-09-25 17:43 This you can find by installing Indy for Lazarus/FreePascal in file IdWinsock2.pas ---------------------------------------------------------------------- PascalDragon · 2022-09-25 19:10 Quote from: engine32 on September 25, 2022, 07:11:16 pm  After much search, I found one header file that does not contain this define. I see for example: Quote#define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} but not WSAID_MULTIPLE_RIO GUID . Best is to install the Windows SDK and to search through the corresponding include directory. Quote from: engine32 on September 25, 2022, 07:11:16 pm  I found a piece of code online with the following: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i               WSAID_MULTIPLE_RIO := &windows.GUID{0x8509e081, 0x96dd, 0x4005, [8]byte{0xb1, 0x65, 0x9e, 0x2e, 0xe8, 0xc7, 0x9e, 0x3f}}              const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER = 0xc8000024              ob := uint32(0)                err = windows.WSAIoctl(socket, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER,                        (*byte)(unsafe.Pointer(WSAID_MULTIPLE_RIO)), uint32(unsafe.Sizeof(*WSAID_MULTIPLE_RIO)),                        (*byte)(unsafe.Pointer(&extensionFunctionTable)), uint32(unsafe.Sizeof(extensionFunctionTable)),                        &ob, nil, 0) How exactly did you translate the code, cause it essentially looks like a mixture of C and Pascal. ---------------------------------------------------------------------- 440bx · 2022-09-25 20:14 Quote from: engine32 on September 25, 2022, 07:11:16 pm  How people using Lazarus are dealing with Windows header files ? I have hard time to find them. I don't know if this will be helpful but, when I'm having a hard time finding something in the C header files, I write a tiny C program that declares a variable of the type I'm looking for, after its compiled, Visual Studio can go directly to where it's defined (courtesy of its intellisense thingy.)  It also works with things other than types. I have a grab-bag C program just for that. ---------------------------------------------------------------------- marcov · 2022-09-25 20:28 mswsock.h has a nice comment: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #define WSAID_MULTIPLE_RIO /* 8509e081-96dd-4005-b165-9e2ee8c79e3f */ \ So you just copy that into a declaration with the style of a GUID declaration from e.g. activex.pp: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const   WSAID_MULTIPLE_RIO : TGUID = '{8509e081-96dd-4005-b165-9e2ee8c79e3f}';  I probably can add it to winsock2 if needed. ---------------------------------------------------------------------- engine32 · 2022-09-25 21:00 Thank you all, now it works   @PascalDragon, that code I found while wandering on internet for the header file with GUID. I just did a test like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   IOC_IN = $80000000;  IOC_OUT = $40000000;  IOC_INOUT = IOC_IN or IOC_OUT;  IOC_WS2 = $08000000;  SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER = IOC_INOUT or IOC_WS2 or 36; // 3355443236; // $C8 00 00 24  WSAID_MULTIPLE_RIO : TGUID = '{8509e081-96dd-4005-b165-9e2ee8c79e3f}';  WSA_FLAG_REGISTERED_IO_BP = 8;..  u32OutBytes := 0;  rRioExtensionFunctionTable.u32Size := 0;  i32Err := WSAIoctl(hSockTest, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, @WSAID_MULTIPLE_RIO, sizeof(WSAID_MULTIPLE_RIO), @rRioExtensionFunctionTable, sizeof(rRioExtensionFunctionTable), @u32OutBytes, 0, 0);    It looks that the issue was that before I provided the GUID as an array of bytes and it did not work. Now with the new format it works, although sizeof(WSAID_MULTIPLE_RIO) reports the same size of 16.   I will install Visual Studio and Indy for Lazarus just for this issue, still better than spending hours for it.   Does Indy for Lazarus supports REGISTERED I/O ? ---------------------------------------------------------------------- KodeZwerg · 2022-09-25 22:20 Quote from: engine32 on September 25, 2022, 11:00:57 pm  Does Indy for Lazarus supports REGISTERED I/O ? Yes. ---------------------------------------------------------------------- KodeZwerg · 2022-09-25 22:22 But I do not know how Indy works hand-in-hand with selfmade Api calls together, so I would realize everything within Indy. ---------------------------------------------------------------------- Remy Lebeau · 2022-09-26 18:27 Quote from: KodeZwerg on September 26, 2022, 12:20:33 amQuote from: engine32 on September 25, 2022, 11:00:57 pmDoes Indy for Lazarus supports REGISTERED I/O ? Yes. Actually, no.  Although Indy does declare the RIO types and constants, it does not actually use them for anything.  They are provided strictly for end-user code to make use of.  Why, I don't know (I didn't write that code). It seems a little counter-intuitive for Indy to waste effort declaring APIs it doesn't use for itself.