Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Win64 - Add/delete SSL Certificate binding prompt error "Parameter is incorrect"
#1
Hi,

I am using IWHSysHeaders provided by the IntraWeb library to programmatically add and delete SSL certificate binding at runtime. 

The code works correctly on the Win32 platform; however, on Win64 it returns the error “The parameter is incorrect” when calling 

Code:
HttpSetServiceConfiguration

and

Code:
HttpDeleteServiceConfiguration

I have attached a sample project for your reference. To reproduce the issue, please update the Host, CertStoreName and CertThumbprint values before running the program. 

Could you please advise what might be wrong with my implementation and how this issue can be resolved?


Attached Files
.zip   d37.sslcertbinding.zip (Size: 10.32 KB / Downloads: 0)
Reply
#2
This is a known pitfall when moving HTTP API code from Win32 to Win64. The issue is not IntraWeb itself, but structure alignment and pointer sizes.
On Win64,
Code:
HTTP_SERVICE_CONFIG_SSL_SET
,
Code:
HTTP_SERVICE_CONFIG_SSL_KEY
, and related records must exactly match the Windows API layout, including correct use of
Code:
ULONG_PTR
, padding, and pointer-sized fields. Code that works in Win32 often fails in Win64 if records are declared manually or copied from older examples.
“The parameter is incorrect” usually means one of these:
  • Record size (
    Code:
    dwLength
    ) is wrong on Win64
  • A field declared as
    Code:
    DWORD
    should be
    Code:
    ULONG_PTR

  • Memory passed to
    Code:
    HttpSetServiceConfiguration
    is not properly aligned
  • Cert hash length or pointer is incorrect (must be 20 bytes for SHA-1)
In Delphi Win64 you must:
  • Use the Windows SDK–correct declarations
  • Avoid hard-coded sizes
  • Ensure
    Code:
    pSslHash
    points to valid memory and
    Code:
    SslHashLength = 20

Many developers fix this by copying the Win64-safe declarations https://tropical-casino.com/ from recent Delphi RTL or Microsoft headers instead of older IntraWeb samples.
If you want, you can paste your record declarations here and I can point out the exact Win64 mismatch.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)