|
CString csUsername;
// Get the Username from the INI file...
GetPrivatProfileString(..., csUsername, ...);
// Put the users name into the edit control...
GetDlgItem(IDC_NICK)->SetWindowText(csUsername);
........OR........
// Get the users name from the edit control...
GetDlgItem(IDC_NICK)->GetWindowText(csUsername);
// Put the Username into the INI file...
WritePrivatProfileString(..., csUsername, ...);
Am I on the wrong track or is there something I missed??
Thanks in advance,
Dan
|
|
|
|
|
How can I quickly transfer large files from one remote Server to a local Server (they are log files). They are updated when alerts come in so, is there also a way to update the file with just the new information
Thanks in advance,
Dan
|
|
|
|
|
I would keep the master log file on the server and just send updates from the client machine(s). Send the log update as a delimited string (if you're sending more than one log entry per update), like so:
"Log entry #1|Log entry #2|Log entry #3"
Of course, you'd have to choose an appropriate delimiter character, but that shouldn't be tough.
And on the server end, parse the string, add the entries to your log file (I assume it's text), and with for the next update to arrive.
I've posted a paitr of string parsing classes on this sight - one that uses MFC and one that uses STL and std::string - that you can use to both build and parse a delimited string.
Here's a link to the article:
http://www.codetools.com/useritems/cstringparser.asp
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
Hi Outlaw...thanks for the tip!
The file to transfer (part or full) is an alert log from an IDS system (Snort). How would I get just the new (last) entries?? An example of it is as follows:
[**] EXPLOIT Possible CodeRed Worm v3 [**]
08/13-05:05:27.577622 111.111.111.111:3363 -> 111.111.111.111:80
TCP TTL:111 TOS:0x0 ID:21504 IpLen:20 DgmLen:552 DF
***A**** Seq: 0x7E1432D1 Ack: 0xD2B81EDD Win: 0x4000 TcpLen: 20
[**] EXPLOIT Possible CodeRed Worm v3(X) [**]
08/13-05:15:22.742893 111.111.111.111:1645 -> 111.111.111.111:80
TCP TTL:102 TOS:0x0 ID:65028 IpLen:20 DgmLen:552 DF
***A**** Seq: 0xC0CDEBF4 Ack: 0xDF5B9FD5 Win: 0x4000 TcpLen: 20
[**] EXPLOIT Possible CodeRed Worm v3(X) [**]
08/13-05:15:28.099871 111.111.111.111 -> 111.111.111.111:80
TCP TTL:116 TOS:0x0 ID:26859 IpLen:20 DgmLen:552 DF
***A**** Seq: 0xEFCD649D Ack: 0xDF7D2101 Win: 0x4000 TcpLen: 20
[**] EXPLOIT Possible CodeRed Worm v3(X) [**]
08/13-05:15:30.137790 111.111.111.111:3061 -> 111.111.111.111:80
TCP TTL:116 TOS:0x0 ID:27031 IpLen:20 DgmLen:552 DF
***A**** Seq: 0xF03C1800 Ack: 0xDF86D0B7 Win: 0x4000 TcpLen: 20
This is just an example of the Alert.ids log. There are a lot of other alerts that could be in here!
Any ideas??
Thanks in advance,
Dan
|
|
|
|
|
I assumed you were the author of both ends of the software. I haven't got a clue as to what you have and what you want to do with it.
I've never heard of Snort.
As for getting the most recent entry, I guess you could just move the alert file to a different place and read it (moving it keeps you from having to lock it to prevent updates while you're reading it).
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
rsync is a program to keep files "synchronized" by transferring just the differences. See the rsync home page. See here for information on running rsync on Windows.
|
|
|
|
|
Who know how to transfer color value from classic office toolbar to OfficeXP toolbar?
|
|
|
|
|
All what I need is create dll file that will could to used by client program in every language .
I created dll in MFC and it is mismatched to another languages !
I want to cover it by ATL and it makes troubles .
What is the right way ???????????????????????????
|
|
|
|
|
ATL is the right way, but it's not exactly intuitive when you're starting. We can help moreif you post some code and tell us what's going wrong...
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thank you !
I will try .
|
|
|
|
|
The Borland Stable compilers and Microsoft Stable compilers use different formats when generating the dlls. You wil have problems if you are using a mixture of Borland products (e.g. Delphi) and Microsoft Products e.g. VC++. Best way to create a module is to use COM.
|
|
|
|
|
* "to use COM" -
Are you mean to ATL ?
Can I do a regular DLL which itself uses(import)a extension DLL ?
Is this way not good for delphi and another lamguages ??? Why ???
|
|
|
|
|
The import library produced by MS Visual C++ is in COFF format (Mangled Names), and Delphi and Borland C++ expects things in OMF format.
See the July 1996 "Under the Hood" article of Microsoft Systems Journal. It talks about different dll formats and ways to get round this.
|
|
|
|
|
I hate to do this, but I've asked the question multiple times and it's the only part of my program not finished. I'm hoping that someone who knows the answer missed it this time because it got pushed out of view pretty quickly.
If anyone knows how to create an Access database from scratch using ADOX, could you please answer my question from yesterday ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I only have seen some VB code to do it:
Const Jet10 = 1
Const Jet11 = 2
Const Jet20 = 3
Const Jet3x = 4
Const Jet4x = 5
Sub CreateNewMDB(FileName, Format)
Dim Catalog
Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=" & Format & _
";Data Source=" & FileName
End Sub
'Create Access2000 database
CreateNewMDB "G:\a2000.mdb", Jet4x
Hope it helps...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Interesting... If I make the line
sprintf(pChar, "Provider=Microsoft.Jet.OLEDB.4.0;Jet Engine Type=5;Data Source=%s;", (char*)DatabasePath);
then I get an error:
Could Not Find Installable ISAM.
Do you know what this means ? BTW the Microsoft exmaples in C++ don't use the 'Jet OLEDB:Engine Type= ' parameter and create useless files just like my code does.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
To be honest I just got the code from a friend of mine and thought that maybe you could use it...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Whoops - fixing the syntax gives me a database I can read from but not write to, for some reason...
Thanks for the step forward. Now I just need to figure why I cannot write to it...
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
The specific problem now is when I try to add data:
if (records->RecordCount != 0)
records->MoveFirst();
CComBSTR bstrPath;
(*it)->get_FilePath(&bstrPath);
char * pStr = new char[bstrPath.Length() + 24];
memset(pStr, 0, bstrPath.Length() + 24);
sprintf(pStr, "[FilePath] = \'%s\'", (char*)(_bstr_t)bstrPath);
try
{
records->Filter = (bstr_t)pStr;
}
catch (...)
{
MessageBox(NULL, "Error", pStr, 0);
}
string renderpath = (bstr_t)bstrPath;
for (string::iterator itr = renderpath.begin(); itr != renderpath.end(); ++itr)
if (*itr == '?') *itr = '\'';
CComBSTR callback(renderpath.c_str());
Fire_ScanningFile(callback);
if (records->RecordCount == 0)
{
The above code opens the recordset, moves to the start if it has records, replaces ? with ' in the filename ( having ' in my records killed my query statements ), sends a callback and then checks if the record count is 0 after the filter, which means I should add the record. Now if I create the DB programatically, this code always falls through, and records->RecordCount ALWAYS equals 1 ( tried with zero, one and two records in the DB. The odd thing is that everything is fine in Access, I can add & remove records, and they show OK in my program. The *other* odd thing is if I called Records->MoveFirst() when there were zero recordsin the DB created in Access it would crash, unless it crashes if it finds zero for no REAL reason, and for some reason it's finding one, which is OK.
Argh !!!!!
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I'm not sure if I got this right, but:
1. How are you opening your recordset? Recordcount returns different numbers depending on cursor type you choose.
2. Use EOF instead of recordcount to check the status of your recordset. You always have to check eof before using Move(...) functions.
HTH
Regards,
Wanderley
|
|
|
|
|
Thanks for the reply.
1/
_RecordsetPtr records = NULL;
records.CreateInstance(__uuidof(Recordset));
try
{
records->CursorType = adOpenStatic;
records->CursorLocation = adUseClient;
records->Open("SELECT * FROM FileDatabase",
_variant_t((IDispatch*)m_Connection, true), adOpenKeyset, adLockOptimistic,
adCmdUnknown);
}
catch(...)
{
}
This works with the db created in Access, but the one I am now creating in ADOX opens fine, reads fine, but the Filter always returns that I have one record.
2/ I was using EOF to start with, I changed it to RecordCount when I was trying to fix this problem. Same result both ways.
Thanks for any suggestions you may have...
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi
Did you fix you problem? One day away from CodeProject and your message almost disappeared
Is there any reason to use Filter instead of opening your recordset using WHERE in your SQL statement? This way you can check for EOF right after you open the recordset.
I have no clue why it works when you create your db in Acess - maybe a bug in ADOX... Anyway, could you send me some files to check if I have the same problem here?
Regards,
Wanderley
|
|
|
|
|
Thanks for the reply.
Two reasons:
1/ I am filtering by each potential new record in order to find out if it exists, so I don't want to open the recordset over and over
2/ When I've tried to impliment filter, it crashes every time.
The thing I don't get is if ADOX is the problem, why is the created DB file exactly the same as the one Access creates and allows me to add data within Access... I'll send you a zip of some files, thank you.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I created ATL and I want to use it in my project (MFC Dialog project)
But I dont success to create Instance of my ATL.
I maked so :
---------------------------------------------------------------------
insert the files: MyAtl.dll /.h/_i.c to my folder
---------------------------------------------------------------------
#include "MyAtl.h"
#include "MyAtl_i.c"
---------------------------------------------------------------------
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr)){ .....}
IAtlObj *pHello=NULL;
hr =CoCreateInstance(CLSID_CIQS, NULL,CLSCTX_ALL,IID_ICIQ, (void**&pHello);
if (FAILED(hr)) {.......} //==>> and in runtime it is failed here
----------------------------------------------------------------------
What is the problem ?
|
|
|
|
|
It's easier to use #import if you can. Have you checked to see what the error is ? Does the above line have a typo so that you're really casting to void ** ( no close brackets ) ? Also should it be CLSID_CIQ*S* but IID_ICIQ ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|