GetUserInfoAndUpdateCookie
This function pulls the user information out of the cookie. It parses out the credentials from the cookie and passes them along to the DecodeAndDecryptCredentials function. In return, it gets the plain username and password, and uses those to log the user into the server.
The LogonUser function used essentially logs the user in the same as Basic authentication. So anything you might have been doing with Basic authentication you should be able to do with this, and then some.
Then the user information is set along with the token used for impersonation.
DecodeAndDecryptCredentials
This is the function where you would put your decryption code. That is, if you encrypted the credentials in the first place, which I HIGHLY suggest you do.
The login page I used was a ASP.NET page, so I used encryption that could be encoded/decoded in both .NET and C++.