|
My problem is that I want to capture all packets which are sent to or received by my computer. However, I don't know how to do that if I don't use WinPcap or Ethereal...I just use the API functions of windows. Would you tell me some instructions about how to do that or point me to some specific websites that show me clearly about the technique. thanks
|
|
|
|
|
vtalau wrote: if I don't use WinPcap or Ethereal...I just use the API functions of windows. Would you tell me some instructions about how to do that or point me to some specific websites that show me clearly about the technique. thanks
look for IPHelper Api! or you can hook WinSock dll.. to see what going out or what coming in , try this link for more HOOK winsock[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
The demo attached to the article you sent me doesn't operate. I can't hook a api function of a dll successfully. By any way, thank you so much for widening my knownledge.
|
|
|
|
|
Hi, I'm now trying to simulating keyboard stroke that affect all application that running but i experiment that keybd_event(...) and SendInput(...) doesn't effect to the application that using DirectInput. Hook is useless too! May you help me solve this problem! Thank very much.
Note: I read the DirectX documentation and I known that DirectInput connect directly with hardware's driver;may it is helpful.
|
|
|
|
|
The problem is, what key stroke are you trying to send, and what result do you expect ? Sending an event to an app will not send it to a text box on the visible window. DX won't help, it's just another layer you need to get through. Most apps are not using DX.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i know there is few app using DirectInput, but i want simulate keystroke perfectly; i want a DirectInput app receive the keystroke. As i said: when i using SendInput(...) the DirectInput app can not receive the key(any key) but another app can receive it normal. i think hook is useless because DirectInput app doesn't receive keyboard frome system message queue and i think SendInput(...) only place keyboard message to system message queue so that the DirectInput app can't receive this keystroke.
From model of keyboard of MSDN library: i think i need a function that can send keystroke to the keyboard's device driver. Please help me!
|
|
|
|
|
i have been trying to learn how to do directx programming in c++ but have not found any source code from tutorials that will compile. i am using visual studio express edition. when i try to compile the code that came with the directx 9 sdk it gives me errors for the include file 'winnt.h' such as:
winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
winnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
winnt.h(5940) : error C2146: syntax error : missing ';' before identifier 'Buffer'
winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
what is causing this and how can i fix it? the only include file that i have is d3d9.h.
also if anyone can point me towards a good direct3d beginners tutorial it would be very helpful.
thank you in advance for any help you can offer
- Kyle
|
|
|
|
|
try to change the compiling version from the current into another ,
let see if it will work
|
|
|
|
|
suchuhui wrote: try to change the compiling version from the current into another ,
let see if it will work
how do i do this?
- Kyle
|
|
|
|
|
I fixed the errors using the steps on this[^] page. i skipped the 4th step.
thank you for the ideas and input
- Kyle
|
|
|
|
|
Hi All,
I am a noob with VC++ coding so spare with me. I am trying to create an GUI application that will allow the user to create email accounts in Outlook Express. Something like a simple version of the Wizard itself.
The form has 3 fields, where the first field will Propagate the "Display Name", 2nd field will be there "User ID = email address" and 3rd field is their "password".
I am using the following code:
<br />
<br />
void CEmailDlg::OnBnClickedButton1()<br />
{<br />
<br />
<br />
UpdateData( TRUE );<br />
CString custaddy;<br />
CString custpass;<br />
custaddy = custuser;<br />
DWORD dwVal = 0;<br />
DWORD dwDial = 3;<br />
CString URL = "someURL";<br />
CString POP3 = "somePOP3";<br />
CString SMTP = "someSMTP";<br />
CString connectoid = "Dial-up";<br />
int userlength = custuser.GetLength();<br />
if (!custuser.Right(12).CompareNoCase("@realm"))<br />
<br />
{<br />
userlength = userlength - 12;<br />
custaddy = custuser.Left(userlength);<br />
custaddy += (_T("@realm"));<br />
<br />
}<br />
<br />
else if (!custuser.Right(17).CompareNoCase("@anotherrealm"))<br />
<br />
{<br />
userlength = userlength - 17;<br />
custaddy = custuser.Left(userlength);<br />
custaddy += (_T("@anotherrealm"));<br />
}<br />
<br />
else<br />
<br />
{<br />
CString msgString = "Please make sure you enter you full Dial-up email address. This will be in the format of 'username@realm'.";<br />
AfxMessageBox( msgString, MB_OK | MB_ICONEXCLAMATION );<br />
return;<br />
}<br />
<br />
AfxMessageBox("Your email address will now be configured. Click the OK button to proceed.");<br />
HKEY hKey;<br />
unsigned long dwDisp;<br />
<br />
<br />
if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Internet Account Manager"), 0,<br />
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS)<br />
<br />
{<br />
RegSetValueEx(hKey, "Default Mail Account", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
<br />
RegCloseKey(hKey);<br />
}<br />
<br />
<br />
<br />
if (RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Internet Account Manager\\Accounts\\"+custaddy+""), 0,<br />
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS)<br />
<br />
{<br />
<br />
RegSetValueEx(hKey, "POP3 Server", 0, REG_SZ,(BYTE *)(LPCTSTR)POP3,lstrlen(POP3));<br />
RegSetValueEx(hKey, "SMTP Server", 0, REG_SZ,(BYTE *)(LPCTSTR)SMTP,lstrlen(SMTP));<br />
RegSetValueEx(hKey, "POP3 User Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custuser,lstrlen(custuser));<br />
RegSetValueEx(hKey, "SMTP Display Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custname,lstrlen(custname));<br />
RegSetValueEx(hKey, "SMTP Email Address", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
RegSetValueEx(hKey, "Account Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
RegSetValueEx(hKey, "Connection Type", 0, REG_DWORD,(const BYTE *)&dwDial,sizeof(dwDial));<br />
RegSetValueEx(hKey, "POP3 Password2", 0, REG_BINARY,reinterpret_cast<const BYTE*>(static_cast<LPCTSTR>(custpass)),(custpass.GetLength()+1)*sizeof(TCHAR));<br />
RegSetValueEx(hKey, "SMTP Use Sicily", 0, REG_DWORD,(const BYTE *)&dwVal,sizeof(dwVal));<br />
<br />
RegCloseKey(hKey);<br />
}<br />
<br />
But the problem with this is, i am unable to get the password stored properly as a Binary format.
Can anyone have a look and give a solution for this code?
Thank you in advance.
amano
|
|
|
|
|
The password is encrypted, so unless you know the encryption method used you will not be able to read or save the password using registry functions.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks PJ,
Would anyone happent to know what the encryption would be???
And how could i be encrypting it once i do know what the encryption is?
amano
|
|
|
|
|
Hello everyone!
Alright... It's been over 2 weeks of trying to fix this now...
Here's a file:
|............||......................................................................................................................................................|.............|
I open the file using fopen(), then I read it using this:
<br />
fseek(f[x], i*(WIDTH/32)+j, SEEK_SET);<br />
char v = fgetc(f[x]);<br />
WIDTH/32 is 16, i and j are here:
for (int i = 0; i < HEIGHT/32; i++)<br />
{<br />
for (int j = 0; j < WIDTH/32; j++)<br />
{
I have a temporary file stream to "outputz.txt", and after a byte has been read, it is written to that outputz stream... But, at the end, this is what I get on outputz.txt:
...........................................................................................................................................|............|ÿ
Kinda different from the first file, eh? What could be the problem?
Here's my function:
http://sulfurmidis.com/func.htm[^]
Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Instead of having a file full of periods, why not run a text file through your function? Using a text file that you can read will give you the ability to quickly see what characters you are missing, or reading double etc. Using just periods makes it really dificult to figure out what is going wrong.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
AHA!! YES I FINALLY GOT THERE!!!
(A while ago, I went to a friend's house with my laptop, and I was making this program, and I had gotten to a point in which I was almost about to fix it! But the battery ran out, and I fell asleep as soon as I got home, and the next day I forgot how to get there again... ) But now I got to that point again!
Look at the file again:
|...........||.......................................................................................................................................................|.............|
outputz.txt outputs exactly like the original (except with 1 extra space at the end), but now it looks like it's a rendering problem... Can you check out my rendering function also?
It has another temp stream, "temp.txt", which outputs this:
|..............................................|.....................|..................................................................|..........|................................
Totally different, as you can see... This function uses the values from this->mapLayers , which I made when in the first function I posted, instead of characters... Here's the new func:
(I was gonna upload it, but my crappy-butt host timed out when accepting my password)
void Mazzee::DrawMap()<br />
{<br />
FILE * temp = fopen("temp.txt", "wb");<br />
<br />
for (int v = 0; v < 1; v++)<br />
{<br />
for (int x = 0; x < WIDTH; x += CHARW)<br />
{<br />
for (int y = 0; y < HEIGHT; y += CHARH)<br />
{<br />
SDL_Rect src, dest;<br />
<br />
if (v == 0)<br />
{<br />
if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == LX_EMPTY) fputs(".", temp);<br />
else if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == L1_GRASS) fputs("|", temp);<br />
<br />
if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == L1_GRASS) src.x = CHARW;<br />
}<br />
else if (v == 1)<br />
{<br />
if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == L2_ROCK) src.x = CHARW;<br />
}<br />
else if (v == 2)<br />
{<br />
if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(y/32) * (WIDTH/32) + (x/32)] == L3_TELEPORTER) src.x = CHARW;<br />
}<br />
else<br />
{<br />
MessageBox(NULL, "Hi!", "None was found...", MB_OK);<br />
}<br />
<br />
src.y = 0;<br />
src.h = CHARH;<br />
src.w = CHARW;<br />
<br />
dest.x = x;<br />
dest.y = y;<br />
dest.h = CHARH;<br />
dest.w = CHARW;<br />
<br />
SDL_BlitSurface(this->mapLayerTiles[v], &src, this->screen, &dest);<br />
}<br />
}<br />
}<br />
<br />
fclose(temp);<br />
}<br />
Any ideas? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
I would recommend using C++ for file handling.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: I would recommend using C++ for file handling.
Why? I'm earnestly interested in your reasons. I'm used to the c-style versions and would like to know if I'm missing out on something I'm not aware of.
Jeremy Falcon
|
|
|
|
|
I also prefer the C++ file handling mechanism. Here's why I think they're better then the C counter parts.
Simplicity. The following code outputs an integer, a string and a complex number. In C we would have the call different function for each type (or use something like fprintf , but then we run into type safety issues, which is my last point, and it only works for a set number of types which doesn't include complex ):
#include <fstream>
#include <complex>
using namespace std;
int main(int argc, char* argv[])
{
ofstream fs("C:\\out.txt");
fs << 1 << endl;
fs << "Hello" << endl;
complex<int> ComplexNumber(1,2);
fs << "This is a complex number: " << ComplexNumber << endl;
return 0;
}
Extensibility. We can extend the mechanism and when done exactly the same syntax works with our own types:
#include <iostream>
#include <string>
using namespace std;
struct MyData
{
MyData(const char* pName, int Age): m_Name(pName), m_Age(Age) {}
string m_Name;
int m_Age;
};
ostream& operator<<(ostream& stm, const MyData& data)
{
stm << "Name: " << data.m_Name << " (" << data.m_Age << ")";
return stm;
}
int main(int argc, char* argv[])
{
MyData Person("Bob", 20);
cout << Person << endl;
return 0;
}
And lastly, type safety. No fprintf evil which result if the type and the format string don't match.
Steve
|
|
|
|
|
You are not missing anything. C++ just ends up calling the C functions anyway. fstream.open() calls fopen() which end up calling CreateFile(). Same sh*t, different pile.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I disagree totally. The benefits include object orientation, type safety, custom inserters and extractors. By your logic, we should all be writing programs in assembly, hell, that's what it all ends up as, right ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In addition to the comments that have been made, iostreams is a powerful framework for passing data to any stream ( the obvious, non file examples are the screen and a string ), and in particular, for writing code to encapsulate how your data is passed. I find it much nicer to write an inserter and extractor for a class, so my main code looks like this
myFile << myObject;
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
I detect one problem in your code.
you can try it. I am not sure but I think thats the problem.
your code goes like this
...
if(feof(f[x]))
return;
fseek(....);
char v = fgetc(f[x]);
if(x == 0)
fputc(v, outputz);
...
I suggest to put the EOF condition after you read the character.
i.e
fseek(....);
char v = fgetc(f[x]);
if(feof(f[x]))
return;
if(x == 0)
fputc(v, outputz);
Best of luck
Anil
|
|
|
|
|
|
Hi,
I have a project which accesses a database via a database interface class which uses #include <afxdb.h> microsoft library.
In the header file for this database class I have a prototype which passes by reference a CRecordset paramater.
When i add in #include <afxdb.h> in to the header file.
I get the 2872: 'IServiceProvider' : ambiguous symbol
Can anyone help.
To summarise .. I have two files Database.cpp and Database.h. both have to #include <afxdb.h>. When I compile i get the following error. 2872: 'IServiceProvider' : ambiguous symbol.
The class is a general c++ class the compiler is c++ 7.1 and the .net framework is 1.1.
Jerry
|
|
|
|
|