[plt-scheme] Password validation in the web-server on Windows
Yoav Goldberg wrote:
> Look for advapi32.dll, you should have it on your machine.
>
> Here is some sample code:
> (require (lib "foreign.ss"))
> (unsafe!)
> (define advapi (ffi-lib "advapi32"))
> (define LogonUserA (get-ffi-obj "LogonUserA" advapi (_fun _string
> _string _string _int _int (_ptr o _int) -> _int)))
> (define check-login
> (lambda (username domain pass)
> (if
> (= 0 (LogonUserA username domain pass 4 0)) ;;
> 4:LOGON32_LOGON_BATCH 0:LOGON32_PROVIDER_DEFAULT
> #f
> #t)))
>
> Note: as I said, I'm on a win2k machince, so it always fail here.
> It should work fine on WinXP - if it doesn't, maybe it's because
> _string is not the correct type to use - I don't know "foreign.ss"
> well enough. Also, keep in mind that this code doesn't close the
> returned handle, and on a real system you definately want to close
> that handle (using the CloseHandle API).
Thank you very much, I think it works.
I did have advapi32.dll - I guess Google Desktop doesn't index dll-files.
--
Jens Axel Søgaard