Click here to Skip to main content
15,905,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: How can i lock the internet from a C++ program Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:22
Iain Clarke, Warrior Programmer18-Sep-08 5:22 
AnswerRe: How can i lock the internet from a C++ program Pin
Bram van Kampen18-Sep-08 14:55
Bram van Kampen18-Sep-08 14:55 
QuestionRatio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:01
simon alec smith18-Sep-08 5:01 
QuestionRe: Ratio result placing a square not working - when resizing window Pin
David Crow18-Sep-08 5:26
David Crow18-Sep-08 5:26 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:30
simon alec smith18-Sep-08 5:30 
AnswerRe: Ratio result placing a square not working - when resizing window [modified] Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:29
Iain Clarke, Warrior Programmer18-Sep-08 5:29 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
Mark Salsbery18-Sep-08 5:56
Mark Salsbery18-Sep-08 5:56 
QuestionWinInet issue Pin
George_George18-Sep-08 4:16
George_George18-Sep-08 4:16 
Hello everyone,


I want to implement the shake hands of Windows Integrated Authentication for myself. Here is a reference link of the protocol and steps of shakehands.

http://en.wikipedia.org/wiki/NTLM

I have tried a prototype using WinInet API below, and find each time when using WinInet API InternetOpenUrl, this API will handle all underlying authentication shakehands for me. :wave:

http://TestMachine/Monitor is a web site setup by IIS with Windows Integrated Authentication, and the following invocation of InternetOpenUrl will automatically returns 200 OK and will use my current login user's credential automatically -- no change for me to parse return each time from IIS and do the shakehands by myself.

My question is, could I use WinInet level API like InternetOpenUrl to achieve my goal? Why?

My simple code.

#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include <wininet.h>
#include <stdlib.h>
#include <iostream>
using namespace std;

int main()
{
	HINTERNET hINet = InternetOpen(TEXT("InetURL/1.0"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
	if ( !hINet )
	{
		return EXIT_FAILURE;
	}
	HINTERNET hFile = InternetOpenUrl( hINet, TEXT("http://TestMachine/Monitor"), NULL, 0, 0, 0 );
	if(hFile)
	{
	CHAR buffer[1024]={0};
	DWORD dwRead;

	while ( InternetReadFile( hFile, buffer, 1023, &dwRead ) )
	{
	if ( dwRead == 0 )
	break; 
	buffer[dwRead] = 0; 
	cout << buffer << endl;
	} 
	InternetCloseHandle( hFile );
	}
	InternetCloseHandle(hINet);

	return EXIT_SUCCESS;
} 



thanks in advance,
George
QuestionDrawing wider dashed lines Pin
softwaremonkey18-Sep-08 2:18
softwaremonkey18-Sep-08 2:18 
AnswerRe: Drawing wider dashed lines Pin
Cedric Moonen18-Sep-08 2:35
Cedric Moonen18-Sep-08 2:35 
GeneralRe: Drawing wider dashed lines Pin
softwaremonkey18-Sep-08 4:44
softwaremonkey18-Sep-08 4:44 
QuestionCSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:09
tenwang18-Sep-08 2:09 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:11
tenwang18-Sep-08 2:11 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
KarstenK18-Sep-08 2:13
mveKarstenK18-Sep-08 2:13 
GeneralRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:19
tenwang18-Sep-08 2:19 
QuestionRe: CSpinButtonControl : undeclared identifier. Pin
Roger Stoltz18-Sep-08 2:20
Roger Stoltz18-Sep-08 2:20 
AnswerRe: Pin
tenwang18-Sep-08 18:39
tenwang18-Sep-08 18:39 
AnswerRe: Pin
Roger Stoltz18-Sep-08 21:29
Roger Stoltz18-Sep-08 21:29 
GeneralRe: Pin
tenwang18-Sep-08 21:51
tenwang18-Sep-08 21:51 
AnswerRe: Pin
Roger Stoltz18-Sep-08 22:16
Roger Stoltz18-Sep-08 22:16 
GeneralRe: Pin
tenwang18-Sep-08 23:12
tenwang18-Sep-08 23:12 
Questiongethostname() function returns errror Pin
Anu_Bala18-Sep-08 1:38
Anu_Bala18-Sep-08 1:38 
AnswerRe: gethostname() function returns errror Pin
Roger Stoltz18-Sep-08 1:55
Roger Stoltz18-Sep-08 1:55 
GeneralRe: gethostname() function returns errror Pin
Anu_Bala18-Sep-08 2:11
Anu_Bala18-Sep-08 2:11 
GeneralRe: gethostname() function returns errror Pin
Rajesh R Subramanian18-Sep-08 2:27
professionalRajesh R Subramanian18-Sep-08 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.