|
Hi, Just added an unconditional GetLastError() call after the SetWaitableTimer() call as you suggested. It returned 0 (ERROR_SUCCESS) on the Win2K system, so I guess that restore IS supported. Any other ideas that can throw some light on the matter ?
Doug
|
|
|
|
|
As far as I know a suspended PC does not execute user-mode code, so you can only wake up the PC with a kernel-mode driver!
Don't try it, just do it!
|
|
|
|
|
Alexander M. wrote:
As far as I know a suspended PC does not execute user-mode code, so you can only wake up the PC with a kernel-mode driver!
Can you suggest how I can persue this particular direction ?
Doug
|
|
|
|
|
I have absolutly no idea. You have to study the DDK, maybe you'll find a description there.
Don't try it, just do it!
|
|
|
|
|
Seems mildly ironic that you can suspend the system in user-mode code, but need to be "priviliged" by being in kernel mode to wake it up !!!!!! I'm now persuing a hardware solution to the timing/wakeup problem rather than peruing kernel-mode code (which sounds quite daunting and not really worth the undoubtedly steep learning curve to satisfy my needs !! Thanks for your help !
Doug
|
|
|
|
|
Hello!
all password managers I know handle passwords with standard Windows edit controls, which have the password flag set. As soon as the dialog with the edit control is closed, the password storage memory is erased by the application of course. But *while* the dialog is open, the passwords are stored in plain-text in the process memory.
Some people seem to worry about the password being visible in the memory space of the applications process. You normally cannot avoid this when using standard Windows controls, they are just designed like this. Also, the security risk of this is minimal anyway, since Windows normally doesn't move the memory of the current foreground process to the swap file.
Now, I've found some way to completely hide the password (at least I believe so). It won't even show up in the process memory.
If you're interested, try this:
http://www.dominik-reichl.de/filepool/SecEditExTest.zip[^]
Of course, no new features without new limitations. Character selections aren't allowed in this secure edit control, i.e. you cannot select any range of characters. You can paste information *into* the edit control, but you cannot copy something *out* of it (try it with one of the many edit control spies available on the net). If you want to delete all the text in the control, press Shift-Home or Shift-End.
The edit control at the top is a standard Windows edit control. When you enter something here, it should be visible in the process memory. Below this control, there is the secure edit control. The things you enter here should not appear in the process memory!
When you press the "Show Password" button on the left of the new secure edit control, a message box will show you the password. NOTE: while the message box is shown, the password is visible in the process memory space of course! That's normal! Close the message box and your password should be gone again (though it is entered in the edit control).
Please, test this control thoroughly. Especially, search for entered strings in the process memory space (with WinHex for example). Test it thoroughly with special characters (high ANSI characters). I'm especially looking forward to a report if the control works with multi-byte systems (Chinese system for example).
And yes, if everything goes right, I'll write an article here at CodeProject about this control
Thanks and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Send me the source code, then I'll tell you how secure that control is.
Don't try it, just do it!
|
|
|
|
|
|
Looks interesting!
The code is secure in 2 ways:
1) Every character is encrypted.
2) The characters are spreaded over the whole process memory because of dynamic memory allocation.
That's really nice!!!
The only feature that you should implement is selecting characters in the text box.
Don't try it, just do it!
|
|
|
|
|
Hi everybody, i want to create an a system tray icon in my program, so i write the next code in my dialog's OnInitDialogFunction() ,
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = (HWND)this;
tnid.uID = IDR_MAINFRAME;
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = WM_MOUSEMOVE;
tnid.hIcon = m_hIcon;
tnid.szTip[0] = 'Hi';
Shell_NotifyIcon(NIM_ADD, &tnid);
the problem is that the icon appears in the taskbar but as soon as i move my mouse over it it dissapears,please help.
i'd also like a context menu to appear when i rightclick on it.
Regards
m0n0
|
|
|
|
|
Giorgi Moniava wrote:
NOTIFYICONDATA tnid;
Make it member of class instead of Local!
Giorgi Moniava wrote:
i'd also like a context menu to appear when i rightclick on it.
serach Cp for TrayIcon
cheers,
Alok Gupta
|
|
|
|
|
"Make it member of class instead of Local!" could you be more explicit??
Regards
m0n0
|
|
|
|
|
I want to say that, Make you NOTIFYICONDATA variable member of Class instead of local variable of Function
because as function end it looses it memory, so you looses your icon.
cheers,
Alok Gupta
|
|
|
|
|
HI Giorgi!
you can look at this article where i have taught how to handle system Tray Icon!
http://www.codeproject.com/system/ShutDownAlarm.asp[^]
hope that work well for you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
tnid.szTip[0] = 'Hi';
That does not work!!!!
szTip is an array, and you can't set it that way!!!
First of all, strings in C++ are written with ", not '.
You can never copy an array by assign it to another one!
To copy a string, use strcpy.
strcpy( tnid.szTip, "Hi" );
That should work!
tnid.hWnd = (HWND)this;
Also wrong! (I assume that the this ptr is a CWnd)
tnid.hWnd = GetSafeHwnd();
Using WM_MOUSEMOVE as callback is also not very intelligent!
Define a custom message, e.g. #define WM_TRAYICON WM_USER + 1
You should really learn the programming language first before starting to code!
Don't try it, just do it!
|
|
|
|
|
Thanks for help,i've used as callback function this function
LRESULT CtaskbarDlg::MyMessage(WPARAM wParam, LPARAM lPararm)
{
MessageBox("Hi");
return LRESULT();
}
when i move my mouse over the icon in tray , i get this message , but then i get loop of messages ???
do you know why??
Regards
m0n0
|
|
|
|
|
Giorgi Moniava wrote:
return LRESULT();
What the hell is this? You have to learn C++ I said!
I think you don't know anything about C++, windows, MFC and everything you have talking about!
It is not intelligent at all to handle WM_MOUSEMOVE, and even if you would handle the tray icon messages the right way, then it would be still bad.
Mouse move messages are transmitted when the cursor moves on a window, or in that case, on the tray icon. So if the mouse enters the icon area, your message box will occur. Better use a button down message to do that.
And as I said before: Learn C++ before posting source codes, that are wrong, wrong, wrong!
Don't try it, just do it!
|
|
|
|
|
A simple Copy button:
void CTestDlg::OnCopyButton()
{
// TODO: Add your control notification handler code here
FILE *fin = fopen(m_InfileStatic, "r");
if ( fin )
{
FILE *fout = fopen(m_OutfileStatic, "w");
if ( fout )
{
char buf[2048];
while ( fread(buf,2048,1,fin) ){
fwrite(buf,2048,1,fout);
}
fclose(fout);
MessageBox("Done ",",NULL,MB_OK|MB_ICONINFORMATION);
}
fclose(fin);
}
}
input is always multiple of 2 KB. after several loops fread returns 0 (if input is 100 KB it should make 50 loops) producing only 2-8 KB output.
Your explanation would be much appreciated. Thanks.
Lynsen
|
|
|
|
|
try openeing the file as a binary.....might be becoz u r encoutering the ascii value 26(opening in text mode,the function stopz when iit encounterz the value 26)so open in binary format(thiz might be te prob!).....
eg:
FILE *fin = fopen(m_InfileStatic, "rb");
FILE *fout = fopen(m_OutfileStatic, "wb");
hope that helpz.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
Yap, that fixed it! Thanks for your ultra rapid answer.
Lynsen
|
|
|
|
|
God Bless.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
While you already know the answer, you might be interested in knowing how you could have discovered it yourself. Try this:
...
char buf[2048];
int x;
while ((x = fread(buf, sizeof(char), 2048, fin)) == 2048)
{
cout << "Read " << x << " bytes" << endl;
fwrite(buf,sizeof(char),x,fout);
}
if (x > 0)
{
cout << "Read " << x << " bytes" << endl;
fwrite(buf, sizeof(char), x, fout);
} With my 160KB test file, it produced:
Read 2048 bytes
Read 2048 bytes
Read 304 bytes
I simply opened up the source file and looked at offset 4400 which was indeed the ASCII 26 character. BTW, you need to swap the second and third parameters in the calls to fread() and fwrite() . Currently, you are telling fread() to read 1 character whose size is 2048, when instead you should be reading 2048 characters whose size is 1.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi
I have tocreate global variable in ATL project .
When i created and used in another class file of same prject it gives error.
If i declare in another file and include that file in another two class file then it gives redeclaration error.
what should i do.
jhon
|
|
|
|
|
Declare your variable with extern keyword in stdafx.h the global header file of project and declare same variable in .cpp where you want to use that variable file (remember .cpp file)
cheers,
Alok Gupta
|
|
|
|
|
hi
Thanx alok.My problem has been solved.
cheers
|
|
|
|
|