|
So what exactly is your C / C++ / MFC question?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
There are some questions, not one:
- If anyone is interested in help me to make the precompiler (I can extract the functions but not display them to drag&drop using mouse)
- What is the right forum or subforum (in codeproject if possible)
- If it exist a code editor where the precompiler can be added
|
|
|
|
|
Don't you think your first two assumptions are a bit like click-baiting for a response?
One approach is to make your thesis into providing a "novice" or a Java or C# developer the ability to rapidly create a C/C++ application without having to know how to use pointers or code in the language.
Look back at something called "Software through Pictures" STP, and there is another product one of the process control companies makes for modeling potential solutions.
Good luck with that.
|
|
|
|
|
I understand that I can use WinVerifyTrust()[^] to validate a PE file's signature.
But it looks as if this will only tell me if the signature is A) valid and B) from a trusted publisher.
How do I verify that the signature is from a specific publisher?
For instance, I'm worried someone could strip a signature, modify the file, then sign it with their own certificate. The signature in this case would check out, but it wouldn't be from the original publisher.
Is there a way to verify the specific publisher, or is there something about code signing I don't understand?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Bingo! Thank you very much.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Sir, I have coded a program to get a string form a file and compare the string present in the file and which I have defined in my program.
I am using
FILE *opn = fopen("C:\\test.txt","r");
to achieve this and "strcmp" to compare the strings.
I need a suggestion for implementing my code to get the strings of all files present in my computer and comparing with the string which I have defined in the program so that I can find the presence of that file in my computer.
Kindly help me.
|
|
|
|
|
|
Sorry Sir, I think I have not explained my question correctly.I am looking for function which gets the string(will be equal irrespective of the file size) of all files present in the computer and compares with the string which I have defined in my program.More precisely I am looking for a program which searches for the "strings" irrespective of their names.
|
|
|
|
|
Yes I understand your question. And the way to do it, is to get the list of all files in your target set, and then read each file in turn in order to find the string. You can use some the strXXX functions[^] to speed up the searching.
|
|
|
|
|
Sir, What if I do if I run the executable on another computer.I have only "C:\\ and D:\\" drives if I run the executable on another computer which has "C:\\ D:\\ E:\\ " drives my code ultimately fails .How can I get the list of all files on the computer on which my executable runs.I sincerely thank you for giving me the excellent link for speed up my searching.
|
|
|
|
|
You really need to learn how to do some more research for yourself. How do you get a list of all the drives? Type "Windows list drives C++" into Google and start reading.
|
|
|
|
|
Yes, this ("Windows list drives C++") didn't strike to my mind.
Thank you sir for your kind help.
|
|
|
|
|
Are you referring to GetLogicalDrives() or GetLogicalDriveStrings()?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 13-Dec-15 15:28pm.
|
|
|
|
|
Thank you Sir for your kind help. Can you please suggest me some links related to this?
I am searching in google for something related to this(like getting the strings form an executable) but I cannot find one.
|
|
|
|
|
Why do you keep asking this? I have explained what you need to do to find strings in a file, it's now time to go and try it.
|
|
|
|
|
Sir, I have tried a lot and finally figured out something. It is by searching for a specific file with MD5 hashes. Since, I want to search for a specific file through the whole drive.
Here is my try
inline std::string narrow(std::wstring const& text)
{
std::locale const loc("");
wchar_t const* from = text.c_str();
std::size_t const len = text.size();
std::vector<char> buffer(len + 1);
std::use_facet<std::ctype<wchar_t> >(loc).narrow(from, from + len, '_', &buffer[0]);
return std::string(&buffer[0], &buffer[len]);
}
void _tmain(int argc, TCHAR *argv[])
{
HANDLE hFind;
WIN32_FIND_DATA data;
std::string path = "C:\\";
std::string fileName = "";
wchar_t* file = L"C:\\*";
hFind = FindFirstFile(file, &data);
if (hFind != INVALID_HANDLE_VALUE) {
do {
fileName = narrow(data.cFileName);
if (fileName.compare(".") == 0)
continue;
if (fileName.compare("..") == 0)
continue;
cout << "FileName: " << fileName << " MD5 hash: ";
std::string finalFile = path + fileName;
char *cstr = new char[finalFile.length() + 1];
strcpy(cstr, finalFile.c_str());
char **temp = CALL_MD5_Function(cstr);
cout << temp;
cout <<endl << endl;
} while (FindNextFile(hFind, &data));
FindClose(hFind);
}
}
I don't know how to iterate if I found a directory, in here
if (fileName.compare(".") == 0)
continue;
if (fileName.compare("..") == 0)
continue;
I used continue statement to break the skip the operation since I am unsure. Could you please suggest me some ways to do it?
Thank you sir for your kind help
|
|
|
|
|
You should move your find processing to a separate function and call that with the root path you wish to search. You can then call that recursively each time you find a directory, something like:
void ProcessFiles(string root, string directory)
{
string searchPath = }
int main()
{
ProcessFiles("C:\\", NULL);
}
|
|
|
|
|
Thank you sir for your kind help and I am really sorry for the late reply
|
|
|
|
|
Hello, everyone! I am a Chinese programmer. Here is a question I want to specify this:
When I create an application based on Dialog, and then I open the toolbox and put the controls into my application.
I find this:
Button(which is the first control )
and MFC button control
Are they the same or different?
I will appreciate if anyone can provide an example to demonstrate it!
|
|
|
|
|
The Button is a standard Windows control that can be used in a Win32 or MFC application. The MFC Button Control[^] is an MFC class that 'wraps' the standard Button, but can only be used in MFC applications.
|
|
|
|
|
After including
#include <atlbase.h>
. Please suggest
2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4114: same type qualifier used more than once
2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : error C2632: 'char' followed by 'char' is illegal
2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4091: 'typedef ' : ignored on left of 'unsigned char' when no variable is declared
|
|
|
|
|
Such things may happen when including header files in the wrong order, required header files has not been loaded, or are skipped due to exclusions. Because we don't know the other headers file that might be involved, it can't be answered for now.
A common problem is the inclusion of winsock2.h. This must be included before windows.h. I mention it here beacuse RPC is network related.
If this does not help you should try to find out the correct order by inspecting the header file inclusion tree. You can generate an include file tree by editing your project settings (Configuration Properties - C/C++ - Advanced - Show Includes).
Inspect the line of error (154 in rpcnhdr.h) to know which definitions trigger the error. Then try to find these definitions in header files included before that.
|
|
|
|
|
Thanks you for response. Basically I was trying to use ATL in non-ATL application.. Please advise
the line 154 in rpcnhdr.h is
typedef unsigned char byte;
|
|
|
|
|
When you use ATL, then your application is not a non-ATL one.
The first error message is "same type qualifier used more than once". So byte has been already defined.
The next one "'char' followed by 'char' is illegal" indicates that byte has been probably defined using a #define statement so that the compiler sees
typedef unsigned char char;
The third error is just based on the previous one.
So the goal is to find the previous definition of byte and check if the definition can be suppressed or the header file containing it might be included later. That might be some work because atlbase.h includes a lot of other files. I did a quick search but did not found it. But you should better perform this search with your files because they may change with the Visual Studi and the SDK versions.
|
|
|
|