|
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
|
|
|
|
|
Hi,
Is there a simple way to draw dashed lines with a width greater than 1 pixel on a DC?
CPen will not allow a PS_DASHED style with a width of more than 1.
TIA
|
|
|
|
|
LOGBRUSH lb;
lb.lbStyle = BS_SOLID;
lb.lbColor = RGB(0,0,0);
CPen newPen(PS_GEOMETRIC | PS_DASHED , 2, &lb);
For a dashed pen with a width of 2.
|
|
|
|
|
Cheers Cédric thats just what I was looking for!
|
|
|
|
|
I have a CSpinButtonCtrl as a resource in a dialog and I made a variable out of it using GetDlgItem. I compiled the code using WDK6000 on winXP and it compiled without any error.
But when i tried to compile it on win 98, using 95 DDK. I am getting an error :
CSpinButtonControl : undeclared identifier
I have a line in the code like this:
CSpinButtonCtrl *spinobj = (CSpinButtonCtrl *)GetDlgItem(IDC_SPN_COPY);
//IDC_SPN_COPY is the resource id.
I have declared the IDC_SPN_COPY in a header file i am using.
I tried adding #include<afxcmn.h>, but it again gave an error which is like :
cannot open afxcmn.h file.
somebody please help me out..
|
|
|
|
|
I tried adding #include<afxcmn.h>, but it again gave an error which is like :
cannot open afxcmn.h file.
|
|
|
|
|
it looks like the CSpinButtonCtrl came later than 95 DDK.
Google it out...
Update your life
Greetings from Germany
|
|
|
|
|
Man I have tried every possible way
|
|
|
|
|
Ehh, have I understood you correctly; you're building user mode applications with the Driver Kit?
I don't say it's impossible since I think it's the same compiler and linker, but I would consider the environment the wrong tool for the job.
Do you have an existing installation of some Visual Studio version?
Otherwise I doubt you even have the file you're trying to include on your disk.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
yes, i have visual studio 6 and SDK installed on the 98 system.
I am want a spin control on my printer driver UI.
I am getting the error :
CSpinButtonControl : undeclared identifier.
and I read in msdn that afxcmn.h header is for mfc common control.
so, i tried including the header, now it is giving this error.
fatal error C1083: Cannot open include file: 'afxcmn.h': No such file or directory
|
|
|
|
|
tenwang wrote: I read in msdn that afxcmn.h header is for mfc common control.
That's correct, but are you building with support for the MFC framework?
Do you include e.g. afxwin.h anywhere in your source code?
I'm not sure I can help you further, I've never built anything user mode related with any WDK/DDK.
Furthermore I'm not sure what you're trying to do; you're talking about a "printer driver UI", but a driver doesn't have a UI. You may mean a Control Panel application meant to control the driver settings and if that's the case you can check out the WDM sample "Sample Audio Control Panel Application" in the WDK help.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
what i mean was, user interface for the printer driver, i need a spin control for various edit controls, like one for entering no. of copies to be printed.
afxwin.h is included in my code, the thing is that, my code works without error in xp, using wdk environment.
as i m using(i have to) DDk for 98, so i m facing this problem.
|
|
|
|
|
afxcmn.h and afxwin.h are located in the same directory, so if you can successfully include afxwin.h you shouldn't have any problem finding the afxcmn.h file.
Try building without the CSpinButtonCtrl and see if this is the only include problem you have and to verify that you can successfully include the afxwin.h file.
I assume you've included the file by writing...
#include <afxcmn.h> ...and not...
#include "afxcmn.h" ...so the compiler can search the include path instead of assuming the file is located in the project directory.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Yes, I used #include <afxcmn.h>, and i tried without CSpinButtonCtrl in my code, the it gives error for the header file.
I am using afxwin.h since long time back, and i have been using mfc classes like cbutton and cdialog without any hitch.
only after the problem with the CSpinButtonCtrl, i included afxcmn.h. I think, ddk is not having a library which wdk has.
thanks for ur concern...
|
|
|
|
|
I have used the below code to determine the Host Name of the local machine in which the application is running. gethostname() function returns SOCKET_ERROR. The same code works fine in another application. Pls tell me why it is not working in my application. Should I change any Project settings.
SOCKADDR_IN sockAddr;
memset(&sockAddr,0,sizeof(sockAddr));
CString rSocketAddress;
LPHOSTENT lphost;
char HostName[80];
if (gethostname(HostName, sizeof(HostName)) == SOCKET_ERROR)
{
AfxMessageBox(WSAGetLastError());
PostQuitMessage(WM_QUIT);
}
//_tcscpy(mInstSess[ind].INSHost,HostName);
m_sInsHost = HostName;
lphost = gethostbyname(HostName);
if (lphost != NULL)
{
sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
rSocketAddress = inet_ntoa(sockAddr.sin_addr);
//strcpy(mInstSess[ind].INSIP,rSocketAddress);
m_sInsIP = rSocketAddress;
}
Thanks in advance
Anusuya
Anu
|
|
|
|
|
Anu_Bala wrote:
if (gethostname(HostName, sizeof(HostName)) == SOCKET_ERROR)
{
AfxMessageBox(WSAGetLastError());
PostQuitMessage(WM_QUIT);
}
So what does WSAGetLastError() tell you?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
It simply printed m in the messagebox
The function returned -1
Anu
|
|
|
|
|
Anu_Bala wrote: The function returned -1
What? -1?
Here are the error codes and I don't see -1 in it: Windows socket error codes[^]
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
AfxMessageBox() takes either a string to display, or a resource ID corresponding to a post in the string table as argument.
Since you're passing the return value from WSAGetLastError() , which is an integer value, the AfxMessageBox() function will try to load the string that matches that ID from the string table. Likely that ID does not exist in the string table and the call fails, hence the "-1".
Assign the return value from WSAGetLastError() to a variable and debug your code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Anu_Bala wrote: AfxMessageBox(WSAGetLastError());
WSAGetLastError() returns an integer and you are passing it on to AfxMessageBox() . Talk about horror.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Make sure that WSAStartup() or AfxSocketInit() has been called successfully before you call any socket winsock functions.
cheers
Varghese Paul
|
|
|
|
|
Can anybody help me in finding the number of files in a particular folder.
I am using VS 6.0.
With regards
Deepu.
|
|
|
|
|
Do you need to CFileFind Class or FindFirstFile?
|
|
|
|
|
I am using CFileFind
Is that possible by using CFileFind::FindFile and CFile::FindNextFile.
If so can you tell me the procedure.
|
|
|
|
|
This exampl eis on the MSDN.
CFileFind finder;
BOOL bWorking = finder.FindFile(_T("*.*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
TRACE(_T("%s\n"), (LPCTSTR)finder.GetFileName());
}
|
|
|
|