Forum > General

Windows header files

(1/2) > >>

engine32:
  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}}
--- End quote ---
but not WSAID_MULTIPLE_RIO GUID .

  I found a piece of code online with the following:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---                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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  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:
This you can find by installing Indy for Lazarus/FreePascal in file IdWinsock2.pas

PascalDragon:

--- 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}}
--- End quote ---
but not WSAID_MULTIPLE_RIO GUID .
--- End quote ---

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---                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)
--- End quote ---

How exactly did you translate the code, cause it essentially looks like a mixture of C and Pascal.

440bx:

--- 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.

--- End quote ---
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:
mswsock.h has a nice comment:


--- Code: C  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const   WSAID_MULTIPLE_RIO : TGUID = '{8509e081-96dd-4005-b165-9e2ee8c79e3f}'; 
I probably can add it to winsock2 if needed.

Navigation

[0] Message Index

[#] Next page

Go to full version