|
Have you tried looking at the HKCU\Control Panel\Desktop\scrnsave.exe value in the registry? Or, how about opening abcd.scr and looking at the string table resource (value 1)?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yeah Thanks
now i just need to find out how to read string table value of the .scr file
but now i have a way to move forward
thanks a lot
|
|
|
|
|
Helo I want to convert
u_short to long value.
so how to convert it. any library function is used or what?
Regards,
Amit
|
|
|
|
|
You just need to cast it to long;
u_short s = 0;
long l = (long)s;
|
|
|
|
|
I want to make an application (exe file) in visual studio. I want to use this application to copy files from one location to another. This application should accept two command line arguments, one destination path and the other source path. I think I should start from scratch to accomplish this. Can you throw a few pointers as to how to get started with this? are there any tutorial that help me get started with this?
Actually i want to copy a folder from one location to another. But more than the logic to copy, i want to know how to set up the exe to accept the command line arguments and process them.
I want to call the application from somewhere else like this:
<application name=""> <destination location="">.
Many thanks.
|
|
|
|
|
itsh11 wrote: Can you throw a few pointers as to how to get started with this?
Do you know how to open, read from, and write to a file?
itsh11 wrote: ...i want to know how to set up the exe to accept the command line arguments and process them.
int main( int argc, char *argv[] )
{
}
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm making a huge assignment and a part of it want me
to see the wasted space in a file
a friend of me said to me to use system("cls");
what is the meaning of system("cls"); ???
no gain without pain
|
|
|
|
|
This is a call to the OS to clear screen. If you typed in cls at the command prompt, the OS would attempt to clear the screen. Not sure what 'wasted space in a file' is though.
|
|
|
|
|
jeron1 wrote: Not sure what 'wasted space in a file' is though.
Also known as slack space.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i mean with that the un used space in the all the records
no gain without pain
|
|
|
|
|
Well in any case I can't see what "cls" has to do with anything related to a file.
|
|
|
|
|
You can use of cls for clear page of course it was for DOS for example on the GWBasic you could use of clrcls (Im not sure excatly) what do you need excatly?
|
|
|
|
|
Asmo'a wrote: I'm making a huge assignment and a part of it want me
to see the wasted space in a file
As I understand your question, you want to "see" the amount of slack space a file uses. For example, if you have a file that is 8,200 bytes in size, it will actually consume 12,288 bytes on disk. That extra 4,088 bytes is wasted, or slack, space. This, of course, assumes a 4KB allocation unit.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
And why is that slack space there? Because in almost all the files I have seen, when seeing properties size and consumed place are different. Is it something standard? or can be avoided?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: And why is that slack space there?
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for the link
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Has anybody already written some? I am thinking variations on data returned from VirtualQuery could do the trick. Oh yeah, because IsBadReadPtr and IsBadWritePtr won't do anything on Windows Vista, according to MS documentation.
|
|
|
|
|
|
Yes, I know that. I was asking if anyone had already written replacements or knew of anything else.
|
|
|
|
|
#define IsBadReadPtr(x) ((x) == NULL)
#define IsBadWritePtr(x) ((x) == NULL) These functions are that bad. An immediate null pointer check is about as good as it's going to get.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
For a read pointer all we need to know is if VirtualQuery can read it. So you could do something like this:
BOOL IsBadReadPointerCheck(char *p, size_t size)
{
MEMORY_BASIC_INFORMATION mbi;
for (void *pStop = p + size; p < pStop;p =p+mbi.RegionSize)
{
if(!VirtualQuery(p,&mbi,sizeof(mbi)))
{
return FALSE;
}
}
return TRUE;
}
For a write pointer we would need to iterate through the entire range and check the bits stored in the Protect member of the MEMORY_BASIC_INFORMATION structure. Something like this:
BOOL IsBadWritePointer(char *p, size_t size)
{
BOOL bRet = FALSE;
void *pStop = p+size;
MEMORY_BASIC_INFORMATION mbi;
for(p;p < pStop;++p))
{
if(VirtualQueryEx(GetCurrentProcess(),(LPVOID)p,&mbi,sizeof(MEMORY_BASIC_INFORMATION)))
{
if(!(((mbi.Protect & PAGE_READWRITE) == PAGE_READWRITE) || ((mbi.Protect & PAGE_EXECUTE_READWRITE) == PAGE_EXECUTE_READWRITE)))
{
return TRUE;
}
}
}
return bRet;
}
Lets say that you have a pointer to a member function and you want to validate the member function pointer. You might do something like this:
MEMORY_BASIC_INFORMATION mbi;
if(VirtualQueryEx(GetCurrentProcess(),(LPVOID)pInstructions,&mbi,sizeof(MEMORY_BASIC_INFORMATION)))
{
if(mbi.Protect & PAGE_EXECUTE_READ && mbi.State & MEM_COMMIT && mbi.AllocationProtect & PAGE_EXECUTE_WRITECOPY && mbi.Type & MEM_IMAGE)
{
(*this.*MemberFunction)(val);
return TRUE;
}
}
*Disclaimer Edit*
I have not had time to test these functions as I am currently too busy. These functions were removed from some experimental code I was working on some time back. Use/Modify them at your own risk. Just by looking over them I can see they need to have additional error handling.
Best Wishes,
-David Delaune
modified on Friday, May 2, 2008 3:05 PM
|
|
|
|
|
Hello,
i tried to load an unicode file but without luck, but i don't know whats wrong. The first char of the file will not be displayed correctly and then the following data is correct, but at the end there are some more charachters (rectangles) which are not in the file.
Here is the code i use:
<br />
wchar_t *gg;<br />
<br />
FILE *wfile;<br />
wfile = _wfopen(L"ReadMe.txt",L"rb");<br />
fseek(wfile,0,SEEK_END);<br />
int num = ftell(wfile);<br />
fseek(wfile,0,SEEK_SET);<br />
<br />
gg = (wchar_t*)malloc(sizeof(char)*num);<br />
fread(gg,sizeof(wchar_t),num,wfile);<br />
fclose(wfile);<br />
<br />
MessageBox(NULL,gg,L"file",0);<br />
Thanks for help.
|
|
|
|
|
You're allocating num * sizeof(char) and then trying to read num * sizeof(wchar_t) . That going to be your first problem
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
gabbana wrote: wfile = _wfopen(L"ReadMe.txt",L"rb");
For text files, should this be:
wfile = _wfopen(L"ReadMe.txt", L"r");
gabbana wrote: gg = (wchar_t*)malloc(sizeof(char)*num);
gg = (wchar_t*)malloc(sizeof(wchar_t)*num+1);
gg[num] = '\0';
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hmm, the problem still exists:
one rectangle at the beginning at many after the file (>16)
<br />
wchar_t *gg;<br />
<br />
FILE *wfile;<br />
wfile = _wfopen(L"ReadMe.txt",L"r");<br />
fseek(wfile,0,SEEK_END);<br />
int num = ftell(wfile);<br />
fseek(wfile,0,SEEK_SET);<br />
<br />
gg = (wchar_t*)malloc(sizeof(wchar_t)*num+1);<br />
fread(gg,sizeof(wchar_t),num,wfile);<br />
fclose(wfile);<br />
<br />
gg[num] = '\0';
MessageBox(NULL,gg,L"file",0);<br />
modified on Friday, May 2, 2008 10:16 AM
|
|
|
|