Search code examples
httpwinapihttpssmalltalkhttpserver

HttpQueryServiceConfiguration error INVALID_HANDLE


I am trying to get some configuration info for my Http server (implemented using HTTP SERVER API 2.0 from Smalltalk), by calling HttpQueryServiceConfiguration, and I am getting an INVALID_HANDLE (6) error. I have reviewed all the documentation, and I think I am passing the correct parameters. No idea what could be wrong.

Here is how I am calling the api:

| length return |

info := HTTP_SERVICE_CONFIG_URLACL_SET external.
query := HTTP_SERVICE_CONFIG_URLACL_QUERY external.
key := HTTP_SERVICE_CONFIG_URLACL_KEY new.
key urlPrefix: 'http://localhost:50000/tp/'.
query KeyDesc: key.
length := ExternalLong external.
return := self dll
    HttpQueryServiceConfiguration: 0
    ConfigId: HttpServiceConfigUrlAclInfo
    pInputConfigInfo: query asParameter
    InputConfigInfoLength: query sizeInBytes
    pOutputConfigInfo: info asParameter
    OutputConfigInfoLength: info sizeInBytes
    pReturnLength: length asParameter
    pOverlapped: nil.
return = 0 ifFalse: [self osError: return]

Any idea will help,

Thanks!


Solution

  • I found a note in the HttpSetServiceConfiguration function definition at the MSDN documentation. With this initialization, the function succeeds!!.

    Must call HttpInitialize/HttpTerminate If you get error code 6 (ERROR_INVALID_HANDLE) then be aware that you must >call HttpInitialize() with HTTP_INITIALIZE_CONFIG first.