|
You could use the string conversion macro T2W which converts an LPTSTR to a LPWSTR.
Remember to specify the USES_CONVERSION macro at the start of your function.
For example:
void func( LPTSTR lpsz )
{
USES_CONVERSION;
...
LPWSTR x = T2W(lpsz)
// Do something with x
...
}
|
|
|
|
|
I want to develop a firewall but I want to block packets on the base of MAC address. The problem is when I capture a packet on network layer using winsock the MAC address is already stripped off. We can use ARP but it will increase the network traffic and would be difficult to handle. Plz if u have other options tell me or make the use of ARP clear to me as I am a beginner. Refer me relevent sites/links/libraries/api's e.t.c.
Reply me soon
|
|
|
|
|
If you want to firewall at the network level you can't do it through Winsock. Winsock is to high on the stack to be useful as the etherframes are stripped before you get it, and you should move down to the TDI or NDIS layer in kernel mode. There are plenty of examples for this, and the latest XP SP1 DDK has an example of such a driver. You could modify it to suit (as I don't believe it actually touches the MAC).
As a starting point, try going to: http://www.ndis.com/papers/winpktfilter.htm
It is my understanding that PCAUSA provides a lot of infrastructure and documentation on their own NDIS driver source code which you can purchase. You can start reading about it over here: http://www.rawether.net/ndisim/
Have fun,
SilverStr
|
|
|
|
|
dear all,
i get an error in msdev.exe whenever i try to debug my code in windows xp or win 2K.
but i am able to debug in win 98 and win me.
is there some other way for debugging in windows Xp, 2k and NT.
plz. help!
<marquee width="150">rishabhs
|
|
|
|
|
Hi all...
i have one file *.pck file....as what i know this is the compression image file...how i want to uncompress this file to the valid omage file such as *.jpeg or *.bmp file....
Rgds
;);P ((
:_Rocket_:
|
|
|
|
|
I don't know but the smileys are obviously working just fine.
Or are you somewhat emotionally unbalanced today?
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
PCK, are you sure? if it is PCT or PCX try the excellent freeware conversion prog from:-
http://www.xnview.com or http://perso.wanadoo.fr/pierre.g
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
What I want
(1)I create a modeless dialog like the following code. See, MainWndProc triggers a modeless dialog "Data", and "Data" triggers another and destroy itself...
Main->Data->Intro->Exper
(2)I want response to key 'A' always to be processed in the dialog function "Parameter_Window_Exper".
What it does now
(1). "Intro" can't be displayed. Why?
(2). 'A' is taken care by MainWndProc still when "Data" has been triggered.
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_CREATE:
hwnddlg = CreateDialog(app_instance, "PARAMETER_WINDOW_DATA", hwnd, (DLGPROC) Parameter_Window_Data);
break;
case WM_CHAR:
switch(wParam) {
case 'A':
MessageBox(hwnd, "top box","response A", MB_OK);//for temporary test
break;
...
}
BOOL CALLBACK Parameter_Window_Data(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
case IDC_OK:
hwnddlg = CreateDialog(app_instance, EXPER_INTRO_DIALOG, hWnd, (DLGPROC) Parameter_Window_Intro_Func);
DestroyWindow(hWnd);
....
}
BOOL Parameter_Window_Intro(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
case IDC_TRAIN_DONE:
DestroyWindow(hWnd);
hwnddlg = CreateDialog(app_instance, "EURO_PAIR", hWnd, (DLGPROC) Parameter_Window_Exper);
}
BOOL CALLBACK Parameter_Window_Exper(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
case WM_CHAR:
switch(char(wParam))
{
case 'A':
MessageBox(hWnd, "dialog box", "correct A response", MB_OK);
break;
}
....
}
|
|
|
|
|
"Intro" can't be displayed. Why?
"Intro" is created as a child of "Data", so it gets destroyed along with it. Make it a child of "Main", this should fix the problem.
(2). 'A' is taken care by MainWndProc still when "Data" has been triggered.
Not sure what's going on here. Does "Data" have the focus when you press the key?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Anonymous wrote:
'A' is taken care by MainWndProc still when "Data" has been triggered
You have to use IsDialogMessage instead of DispatchMessage .
rechi
|
|
|
|
|
so you mean I should do this? But it seems that the key can't get response from the dialog still.
extern HWND hwnddlg;
int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst, LPSTR lpszCmdLine, int nCmdShow)
{
...
while (GetMessage(&msg, NULL, 0, 0)) {
//TranslateMessage(&msg);
IsDialogMessage(hwnddlg,&msg);
//DispatchMessage(&msg);
}
return (msg.wParam);
}
|
|
|
|
|
You are right, it's not enough; the 'A' is stolen by the control that actually has the focus in the dialog box.
You could fix it by subclassing the controls able to gain the focus or you could create a hidden button with 'A' as mnemonic key.
rechi
|
|
|
|
|
"Hidden button with 'A' as mnemonic key": So clever an solution!!
so by "mnemonic" you mean that I should define a so-called "acceleration key"?
But how to define acceleration key to a button in a dialog? can you explain more? I only know the acceleration key to a menu in the main window--a newbie of windows programming.
Thank you.
|
|
|
|
|
Just type & before the key you want to use as mnemonic for that button.
For example: Butt& on will have the o key as mnemonic.
rechi
|
|
|
|
|
thanks. I am using the studio.net. How to add mnemonic? In the property session, there is no such choice to add/change mnemonic.
Can I add an (text) accelorator description in my .rc file like this?
Exper_Menu ACCELORATORS
{
"1" IDC_FIRST
"2" IDC_SECOND
}
Thanks
|
|
|
|
|
Great, I got it, following your advice and online help.
I appreciate!!
|
|
|
|
|
I have some text and I would like to draw a black outline around it. How does one do this? Do I use pens or do I use another font with differant attributes?
I tried the latter and I got weird results.
Could someone please help!
Cheers,
Cline
|
|
|
|
|
I can't even spell my name
Cheers,
Clint
|
|
|
|
|
I have a C++ client app. that will be used publically within and outside the U.S. What type of encryption can be used to encrypt the packets between the client and server(Win2000)?
|
|
|
|
|
i think 54-bit DES or lower is OK. but, even then, i think you will have to ask the US Dept of Defense. last i checked (a couple of years ago) every application needs to be approved individually.
maybe Bush relaxed the rules on crypto ...
;P
-c
I'm not the droid you're looking for.
|
|
|
|
|
I was thinking of using the Rijndael (symmetric block cipher) for packet encryption. Am I right in thinking that I have to use something like RSA(public key) to transmit the key to the client at the start of the session since symetric cyphers require the same key at both ends?
Couldn't find any examples of this on CP.
|
|
|
|
|
Yes, you will need to use some sort of public key encryption to securely pass the session keys between the server and the client.
Then you can use the symetric encryption between the two.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I remembered seeing an article on Rijndael encryption a couple weeks ago here on CP:
http://www.codeproject.com/cpp/aes.asp[^]
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I am spawning a CDialog from an MFC MDI view.
I am presuming that I will put in stuff (RECT rcNormalPosition ) from the struct in the registry when I shut off the app:
typedef struct tagWINDOWPLACEMENT {
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
} WINDOWPLACEMENT;
Q1. I am not clear about what to store in ptMinPosition, and the corresp. maxpos. CAn I leave these NULL?
When I run the app gain, I want this CDialog excatly where it was and same size etc when I last shut down the app.
Q2. So in what part of the MFC code shall I make the CDialog show up again
( I'll do pDlg->Create() and then MoveWindow to rcNormalPosition ....correct? )
THese CDialogs are not within the mainframe....so will rcNormalPosition put them at those positions from the
computer screen origin? I'll have several CDialogs and I need them to reappear at the precise positions the user chose before he quit.
Appreciate your help,
ns
|
|
|
|
|
Check out this[^] article of mine. In particular, you can use the PlacementHook[^] class to easily accomplish what you need.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|