|
Does any body know about API (hidden) for the Outlook Express to get any information within the OE. I am writing a customization patch for OE. I have just completed Toolbar and reading the current selction from message list (header part), but I could not read the messege header (actual email messaage information.
Any help
|
|
|
|
|
Hi,
I'm developping an ISAPI FILTER that whill be installed on a ISA SERVER. This ISAPI filter should handle the following action for each client which wants to connect to Internet:
1. Gets the user name and the URL of the site to which he or she wanted to navigate
2. redirect any request to an Intranet site which shows a simple Web page with some warnings and also the link to the site to which the user wanted to connect
3. the user can then click on the link and navigate wherever he/she likes
The redirection should happen at the beginning of any network session. Is it true that a network session can contain many session requests??
Where can I find some documentation/help?
You can see my actual code as follows: this code only write a log file to see what happens and try to catch the user name on the AUTH_COMPLETE notification and to catch the URL requested on the PREPROC_HEADERS notification: I'm already sure that there is a problem with getting the user name... can anybody help my?:
#include <windows.h>
#include <httpfilt.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
const UINT MAX_NAME = 10;
const char sFileName[] = "c:\\temp\\AIM_FILTER_LOG.txt";
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc);
static DWORD OnPreprocHeaders (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo);
static DWORD OnReadRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData);
static DWORD OnAuthComplete (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_AUTH_COMPLETE_INFO pAuthCompInfo);
static DWORD OnSendResponse (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_SEND_RESPONSE pResponse);
static DWORD OnSendRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData);
static DWORD OnEndOfRequest (PHTTP_FILTER_CONTEXT pfc);
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc);
static DWORD WriteIntoFile(PHTTP_FILTER_CONTEXT pfc, const char *Testo);
BOOL WINAPI TerminateFilter(
DWORD dwFlags
)
{
return TRUE;
}
BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
{
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
pVer->dwFlags = SF_NOTIFY_ORDER_HIGH | SF_NOTIFY_SECURE_PORT | SF_NOTIFY_NONSECURE_PORT
| SF_NOTIFY_PREPROC_HEADERS | SF_NOTIFY_READ_RAW_DATA | SF_NOTIFY_AUTH_COMPLETE |
SF_NOTIFY_SEND_RESPONSE | SF_NOTIFY_SEND_RAW_DATA |
SF_NOTIFY_END_OF_REQUEST | SF_NOTIFY_END_OF_NET_SESSION;
return TRUE;
}
DWORD WINAPI HttpFilterProc(
PHTTP_FILTER_CONTEXT pfc,
DWORD NotificationType,
LPVOID pvNotification
)
{
DWORD dwRet = SF_STATUS_REQ_NEXT_NOTIFICATION;
switch (NotificationType)
{
case SF_NOTIFY_READ_RAW_DATA:
dwRet = OnReadRawData(pfc, (PHTTP_FILTER_RAW_DATA) pvNotification);
break;
case SF_NOTIFY_PREPROC_HEADERS:
dwRet = OnPreprocHeaders(pfc, (PHTTP_FILTER_PREPROC_HEADERS) pvNotification);
break;
case SF_NOTIFY_AUTH_COMPLETE:
dwRet = OnAuthComplete(pfc, (PHTTP_FILTER_AUTH_COMPLETE_INFO)pvNotification);
break;
case SF_NOTIFY_SEND_RESPONSE:
dwRet = OnSendResponse(pfc, (PHTTP_FILTER_SEND_RESPONSE)pvNotification);
break;
case SF_NOTIFY_SEND_RAW_DATA:
dwRet = OnSendRawData(pfc, (PHTTP_FILTER_RAW_DATA)pvNotification);
break;
case SF_NOTIFY_END_OF_REQUEST:
dwRet = OnEndOfRequest(pfc);
break;
case SF_NOTIFY_END_OF_NET_SESSION:
dwRet = OnEndOfNetSession(pfc);
break;
default:
// We cannot reach here, unless Web Filter support has a BAD ERROR.
dwRet = SF_STATUS_REQ_ERROR;
break;
};
return dwRet;
}
/*
* OnAuthComplete():
*/
static DWORD OnAuthComplete(PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_AUTH_COMPLETE_INFO pAuthCompInfo)
{
HANDLE TokenHandle = (HANDLE)1;
DWORD dwLen = 0;
PTOKEN_USER pTokenUser = NULL;
DWORD dwErr;
char name[MAX_NAME], domain[MAX_NAME];
// Get user token.
if ( pAuthCompInfo->GetUserToken(pfc,&TokenHandle) )
{
// Get token information size.
if ( !GetTokenInformation(TokenHandle,TokenUser,NULL,dwLen,&dwLen) )
{
dwErr = GetLastError();
if ( ERROR_INSUFFICIENT_BUFFER == dwErr )
{
// Alocate buffer for token information.
pTokenUser = (PTOKEN_USER)GlobalAlloc(GPTR,dwLen);
dwErr = S_OK;
}
}
// Now get the actual token information.
if ( dwErr != S_OK ||
!GetTokenInformation(TokenHandle, TokenUser,pTokenUser,dwLen,&dwLen) )
{
// Error …
}
else // We have the token information in hand.
{
// Extract from the token information - the SID.
SID *pSid = (SID *)pTokenUser->User.Sid;
DWORD dwNLen = MAX_NAME, dwDLen = MAX_NAME;
SID_NAME_USE eUse;
// Get the user name and the domain from the SID.
if (!LookupAccountSid(NULL,pSid,name,&dwNLen,domain,&dwDLen,&eUse) )
{
// Error …
}
else
{
// name buffer contains user name.
// domain buffer contains user domain.
}
}
}
if (*name != NULL)
return WriteIntoFile(pfc, "Evento OnAuthComplete: User name:" + *name);
else
return WriteIntoFile(pfc, "Evento OnAuthComplete: ");
return WriteIntoFile(pfc, "Evento OnAuthComplete: ");
}
static DWORD OnPreprocHeaders (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{
char buffer[256];
DWORD buffSize = sizeof(buffer);
BOOL bHeader = pHeaderInfo->GetHeader(pfc, "url", buffer, &buffSize);
//scrive URL nel file
return WriteIntoFile(pfc, "Evento OnPreprocHeaders " + *buffer);
}
/*
* OnReadRawData():
*/
static DWORD OnReadRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData)
{
return WriteIntoFile(pfc, "Evento OnReadRawData: ");
}
/*
* OnSendResponse():
*/
static DWORD OnSendResponse (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_SEND_RESPONSE pResponse)
{
return WriteIntoFile(pfc, "Evento OnSendResponse: ");
}
/*
* OnSendRawData():
*/
static DWORD OnSendRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pInRawData)
{
return WriteIntoFile(pfc, "Evento OnSendRawData: ");
}
/*
* OnEndOfNetSession():
*/
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc)
{
return WriteIntoFile(pfc, "Evento OnEndOfNetSession: ");
}
/*
* OnEndOfRequest():
*/
static DWORD OnEndOfRequest (PHTTP_FILTER_CONTEXT pfc)
{
return WriteIntoFile(pfc, "Evento OnEndOfRequest: ");
}
/*
* WriteIntoFile()
*
*/
static DWORD WriteIntoFile(PHTTP_FILTER_CONTEXT pfc, const char *Testo)
{
std::ofstream myFile;
myFile.open(sFileName,std::ios::app);
if(myFile.is_open())
{
myFile << Testo;
myFile << "\n\n";
//myFile.write(Testo,strlen(Testo));
//myFile.flush();
}
else
{
char myString[] = "Write File Error \n ";
strcat(myString, Testo);
LPBYTE lpBuffer = (LPBYTE)&myString;
DWORD bytesToSend = sizeof myString;
DWORD dwReserved = 0;
pfc->WriteClient(pfc,(LPVOID)lpBuffer,&bytesToSend,dwReserved);
//ErrorHandler("Could not open file."); // process error
return SF_STATUS_REQ_ERROR;
}
myFile.close();
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
|
|
|
|
|
How to make callouts similar to that of in MS-Word application.
I want to add a callout feature to my project.What i have did is created a dynamic textbox and tracker to resize the text. Now i want this text to embeded in a callout which is an image. please help me.
|
|
|
|
|
Sub : How to Load/Save Image in database using VC++ MFC
Hi Guys...
Can any body help me...
I want to save image in database..but i'm not finding any sample code anywhere... can u provide me..I'll be very thankful to u...
So nice of u..
u can send attach-ment at
sumit_kapoor1980@hotmail.com
Thanks..Sumit
---Sumit Kapoor---
|
|
|
|
|
This article[^] with demo sample code.
Maxwell Chen
|
|
|
|
|
Thanks for help..Maxwell Chen
One thinge more to ask is.. How to handle other Image format..such as JPG, Tiff, Gif etc...
I think article is based on Bmp only...What do u say...let me know if u have any idea...
Thanks for last reply..
sumit
---Sumit Kapoor---
|
|
|
|
|
No idea, sorry! I am not good in image processing. But there are some articles out there in CodeProject for various image helper classes such as CPictureEx or something. The way to go would be: using different routines to handle different file types in OnSave(), and storing the image (of certain file name extension) with a specific flag in database. For example:
TABLE ImageGallery
[BLOB] - [Type] - [Size]
{...image A...}, JPEG, 258368
{...image B...}, TIFF, 8942937
Maxwell Chen
|
|
|
|
|
Hi..
thanks again for reply...
Actully I want to save JPEG(I'm particular to JPEG Image Type..So I want help on saving/Loading JPEG Image)...
if U find any sample or code Then let me know..I'll be thnaks full to u..
i've added your e-mail in my yahoo messanger...
U can chat with me any time...
THanks again Bye..
--Sumit Kapoor---
|
|
|
|
|
Take in account that saving images to a database is a terrible principle! Not only the DB gets big in no time, but the process of setting and retrieving images from the database is very slow!
The best way is to store the images as files in the disk and then store the path in the database. Of course that can complicate your program, but if speed is a requirement, you should consider NOT saving them to the databse.
|
|
|
|
|
Miguel Lopes wrote:
The best way is to store the images as files in the disk and then store the path in the database. Of course that can complicate your program, but if speed is a requirement, you should consider NOT saving them to the databse.
I agree with it. This is a better approach! And I guess that Oracle database plays similar tricks with BLOBs.
Maxwell Chen
|
|
|
|
|
Sumit Kapoor wrote:
Actully I want to save JPEG(I'm particular to JPEG Image Type..So I want help on saving/Loading JPEG Image)...
Try CxImage[^]. It seems good!
Sumit Kapoor wrote:
i've added your e-mail in my yahoo messanger...
U can chat with me any time...
I don't use Yahoo messenger though. But do feel free to email me if any I could help. Remember to write the emails with a legitimate title, because of too many spams in Yahoo Mail.
Maxwell Chen
|
|
|
|
|
hi all !
Could anyone give me some pointers as to how to go about locking and/or hiding files/folders or drives like u have in several freeware/shareware apps in the market?
The functionality is basically this :
when a file is protected it cannot be accessed..when an attempt is made it asks for a pre set password.unless correct password is typed it denies access.
For hiding... when i a folder/drive/file is hidden the OS does not detect the presence of the file/folder or drive.
How can i go about this.I was thinking of hooking windows' findfirstfile ( ) but somehow it didn't work out.I saw other codes also but they either needed DDK or didn't work for NT based systems.
I need to have mine work for all windows systems...from 98 to 2003.
Thanks to the contributors in advance !
Regards
Kane
|
|
|
|
|
There are two ways to accomplish this
1.Hooking IAT
you can patch the import address tables to your own functions, good for educational use only
2.Hooking at kernel level
you will have to write a kernel level device driver, which will monitor all file movement, you will need DDK and a LOT of heart
device drivers in 9x are .VXD files which are written differently than a .Sys(NT based device driver) so in order to support 9x system you will have to write a VXD file you will need 9x DDK for that and EVEN MORE HEART
and starting with windows XP microsoft has added extra protection bit (also known as WP bit) to protect kernel level hooking (which suggest that they don't really like ppl hooking in to kernel)
hope it helped
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
hi !
yup...it does thanks. Well the app i am talking has nothing illegal about it so don't worry Could you point me to a decent article about IAT or maybe a snippet of code??it would be of gr8 help i read up Ivo Ivanovs API hooking revealed but it didn't have enough information on IAT .
thankx for the reply !
Kane
|
|
|
|
|
Hi,
How do I get the authentication mode of a DSN in VC++ code.
I am trying something like this.
rc = SQLGetInfo(aDatabase.m_hdbc, XXX,(SQLPOINTER)buffer, sizeof(buffer), &size);
XXX - something/ I dont' know.
Can anybody help me out for this.
Thanks,
Prashant
|
|
|
|
|
Hai,
I Need to how to insert a JPG image file in the picture control of the MFC in VC++...Its supporting only BMP files...
I also need to know how to fetch data from registry and display it in my application.The function REGQUERYVALUE() is used for that but, i dono how the function parameter works....
Kindly help
bye
|
|
|
|
|
For displaying jpg images in ur app search CP for CPicture it's a nice class to display jpg in ur application
For registry support also try searching for CRegistry here.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
I have to make a program like NotePad on Visiual Studio .NET 2003 using C++,but the problem i have is how to make Multiple UNDO.
Live isn't ForEver - LIVE IT
|
|
|
|
|
To make undoes, two steps:
1) define the scope about what's been done and to undo / redo. For example:
struct StepX
{
long PosFrom;
long PosTo;
ColorRef Col;
long Stroke;
};
2) use any of 'container' approach to store the steps. For example:
std::stack<StepX> or something similar.
<b>Maxwell Chen</b>
|
|
|
|
|
Think about "commands"
for example, when typing text, you can make each character or word an "Insert Command", undoing this, will trigger another command, "Delete Text Command" and its undo command is the "Insert Text" ... you see the pattern ...
Each command must know the context and must be "self sufficiant" as much as possible, for example, "Insert Command" will have the text, and the position of insertion.
You need to implement a stack of commands ( written in the other answer ), on which you push and pop the commands.
From There, you can easilly implement the redo .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
In some cases, multiple undo's are too complicated to make like the 2 previous messages said, expecially, when deleting part of some complex structure. If you're dealing with text, which doesnt grow enormously, you could also keep a copy in memory of previous operations. If you specify a, lets say, 10 maximum number of undo's and the text doesnt exceed 50k, that wouldnt be such a bad approach, although its pretty ugly
The method exposed before is much more neat and works for very large structure operations, but can also be difficult to implement.
|
|
|
|
|
Please tell me on, how do I change the caption (name) of dialog window at runtime. I thank in advance.
cheers
mughi
|
|
|
|
|
There is more than way to do that. The easyest one I think is SetWindowText(). Search the MSDN for this function, you'll find the details.
johnnyl
|
|
|
|
|
Thanks a lot. Got it working.
cheers
mughi
|
|
|
|
|
I build a dialog application using VC++, and I want to deal with the keyboard message. but the ON_KeyDown fuction can't work, it can't be called by framework at all. then I find that I can deal with keyboard message in the PreTranslateMessage function, but it just like odd. I think it must have a better method.
thanks
laia
|
|
|
|
|