|
I haven't coded my test program yet, from what I read creating another process with ShellExecuteEx and "runas " should do the runtime elevation. Can I ask, what for would I use AdjustTokenPrivileges() in an elevated process?
|
|
|
|
|
I set the cursor to IDC_WAIT but that shows me the hourglass cursor. However I want to show the arrow+hourglass cursor, where it is has both the arrow and the hourglass, but I can't find the ID for this cursor. Does anyone know what the ID is (i.e. IDC_what???)
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
hello guys....I had been working on this but this did't work. Well this should work now. This is a small TAPI app which if, I call on my lanfline #, should print something
void WINAPI TapiInitialize() {
LPLINEDEVCAPS lineDevCaps = NULL;
lineDevCaps = (LPLINEDEVCAPS)LocalAlloc(LPTR, 4096);
lineCallStatus = NULL;
lineCallStatus = (LPLINECALLSTATUS)LocalAlloc(LPTR,4096);
EventReply = CreateEvent(NULL,FALSE,FALSE,NULL);
memset(&LineInitializeExParams,0,sizeof(LINEINITIALIZEEXPARAMS));
LineInitializeExParams.dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS);
LineInitializeExParams.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
TapiEvent = LineInitializeExParams.Handles.hEvent;
if(TapiEvent==NULL)
printf("\nTAPI event could not be created....");
else
printf("\nTAPI Event Created....");
result = lineInitializeEx(&lineApp,NULL,(LINECALLBACK)lineCallbackFunc,NULL,&numDevs,&tapiVersion,&LineInitializeExParams);
if (result!=0)
printf("TAPI could't be Initialized");
else printf("\n\nTAPI Initialized..");
num = numDevs;
printf("\nNumber of lines available to this app: %d",(LPWSTR)num);
result = lineNegotiateAPIVersion(lineApp,0,API_EARLY_VERSION,API_CURRENT_VERSION,&tapiVersion,0);
result = lineGetDevCaps(lineApp,0,tapiVersion,0,lineDevCaps);
result = lineOpen(lineApp,0,&hLine,tapiVersion,0x00000000,0,LINECALLPRIVILEGE_MONITOR,LINEMEDIAMODE_DATAMODEM,NULL);
if(result!=0)
printf("\n\nLINE could't be Opened...");
else
printf("\n\nLINE Opened...");
result = lineGetStatusMessages(hLine,&lineStatus,0);
if(result==0)
printf("\n\nGetting line status...");
else printf("\nError: Line status not getting...");
}
VOID CALLBACK lineCallbackFunc(DWORD hDevice,DWORD dwMsg, DWORD Param1, DWORD Param2, DWORD Param3) {
printf("\nIncomg Line...");
}
help plzzzzzz....
|
|
|
|
|
overloaded Name wrote: This is a small TAPI app which if, I call on my lanfline #, should print something
But?
overloaded Name wrote: printf("\nNumber of lines available to this app: %d",(LPWSTR)num);
This cast looks strange.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello fellas!
We have a global exception handler "installed" by SetUnhandledExceptionFilter[^] to do some log/dump creating and "gracefully degrade"-ation in case something goes bad. This seems to work quite reliably but...i did some testing by "manually" throwing from inside our code:
throw "stone";
What i don't understand is this: on some systems, this reaches our global handler, creates the dump, displays the "sorry" dialog and shuts down the application, all fine. But on some others, this presents a "CRT runtime error - Abnormal program termination" message box after which is dismissed, the application exits, but our installed global handler doesn't run, so no log/dump is created whatsoever, also, sometimes i see the application "stuck" amongst the processes in task manager.
This particularry seems to happen if i build a release of the project, run it (without debugger), make the exception happen, i get the CRT messagebox, if i copy the same executable to a colegue's PC, run it there, then the global handler gets the exception and works as it should.
So, can anyone explain to me why this happens and how to change it?
I read somewhere that one can also use _set_invalid_parameter_handler[^] to handle CRT exceptions, but the name of this method suggests something else than what i think i am after. Any hints?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
modified on Thursday, September 23, 2010 9:54 AM
|
|
|
|
|
I've had something similar when some other highly clever person in an old team managed to trash the stack. Without the stack there was no way for an exception to find it's way back up to a handler and all sorts of random merriment ensued.
Cheers,
Ash
|
|
|
|
|
I doubt this is the case. The result is always the same CRT-dialog, not random havoc from chaoswille. For testing i started a thread that checks for a certain key-combination and if pressed, throws the exception. There's not much in the call stack that can go wrong (unless somewhere someone corrupts memory maybe but i doubt that) i think.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Are you catching the exception on the thread that throws it? If the exception gets up to the top of your thread's stack and doesn't find a handler you might just find that something in the CRT is throwing an "Abnormal Application Error..."
Cheers,
Ash
PS: Just thought are you setting your exception filter up in every thread?
|
|
|
|
|
As the documentation[^] states: "Enables an application to supersede the top-level exception handler of each thread of a process.", so i don't have to explicitly set this up for every thread, and it seems to be working too (mostly at least).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I am currently migrating a project from VS 2003 to VS2010 ans trying to eliminate all errors and warnings.
On several functions, I get the warning C4748 (can't protect from local buffer overflow because optimizations are deactivated in this function). The entry on MSDN states that this can happen if either optimization is explicitely disabled via #pragma, or if optimization is automatically disabled because the function contains assembler code.
Neither is the case in none of the functions. But why, then, do I get this warning? And, should I do anything about it, or (#pragma ) ignore?
Here's a greatly simplified piece of code that generates this warning:
class MyBase {
public:
MyBase (){}
};
class MyPt : public MyBase {
public:
double v[3];
};
void sum() {
MyPt p1;
}
Note that removing either the constructor, MyBase(), or the data member, v[3], also removes the warning. Using standard double data members instead of an array also does not produce a warning. I am at a loss.
|
|
|
|
|
Can you enable optimizations, or remove the /GS compiler switch?
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Shooting the messenger doesn't solve the problem. Warnings indicate there is a potential problem with the code, and I want to know what the problem with the code is, not the compiler settings to suppress the warnings.
The code I posted above is easy enough, and I do not see anything problematic about it. Yet the compiler tells me otherwise. Why is the explicit inclusion of a constructor supposedly 'worse' than having the compiler autogenerate one? Why does a simple static array data member prevent the compiler from generating code to watch over buffers?
|
|
|
|
|
I copy/pasted this code and I don get a warning (Level 4).
Even if there's a missing ; at the end of
MyBase (){}
Watched code never compiles.
|
|
|
|
|
What compiler did you use?
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
oops forget to say...
VS2010.
Watched code never compiles.
|
|
|
|
|
Hm, just pasted the code to another location and there it compiles fine.
I originally had it at the location where the original definitions are, that produced the error. This leads me to believe that it's not this code, it is something in the headers or code that comes before.
Thanks for giving me the idea to test this, hadn't thought of checking headers.
P.S.:
The line you quoted is a definition, not just a declaration. I am not aware there is any need for a ';'?
|
|
|
|
|
in general, compiler messages and run-time exceptions provide filename, classname, linenumber information to avoid any confusion. use them to your advantage.
|
|
|
|
|
I am assuming this is meant to be helpful, but it is not. The compiler did not give me any more information than what I offered in the OP, and it did point to what in my obfuscated example is represented by the function sum().
There's nothing wrong I see whith that function, nor with the object that is being instantiated there, and still, the fact that this object is there and the class is being defined as it is somehow contributes to the compiler generating a warning.
I wouldn't be surprised if I eventually find the MS libraries to responsible - I just worked on another problem and after about a half hour of searching I eventually realized it was due to a global #define in winsock.h. Thank you MS!
|
|
|
|
|
When I use VS2010 for native C, I get messages such as
...nativecode.c(13) : warning C4700: uninitialized local variable 'k' used
which clearly points to line 13.
What compiler are you using that doesn't do so?
|
|
|
|
|
I've found the culprit. It's the external library declarations. Apparently all or most of them contain lines like this:
# ifdef NT
# ifdef _DEBUG
# pragma comment( lib, "geomkern70d.lib")
# else
# pragma comment( lib, "geomkern70.lib")
# endif
# pragma optimize("", off)
# endif
Note the #pragma optimize line, that is executed independent of whether or not this is debug code (i. e. it's outside the #ifdef _DEBUG block)! This will affect every file that directly or indirectly references this external library! (or any other external library with similar DECL headers)
Obviously, this line overrides the project settings, and thus code does not get optimized, no matter what I say
I will now go and investigate why this line is in there, and whether or not it's safe to remove it. Provided I can still find anyone who was around at the time this code was written...
P.S.: the reason I posted the whole context was that I found a whole bunch of *decl* header files looked exactly like that, so I at first assumed it was generated, either by VS 2003, or whatever IDE was being used at the time these were created. I am still not sure about that...
modified on Friday, September 24, 2010 7:02 AM
|
|
|
|
|
Hi!
I've two arrays. One array of strings. Another one of StaticText boxes. I've to read the array from the end and set each string to the StaticText element starting from the beginning(i.e I've to set the last text to the first static text element). Can anyone help me how to traverse these two arrays?
|
|
|
|
|
Traverse array with static boxes from top to bottom and use another variable to get the values from the second array.
Ex: NO_OF_ELEMENTS is the number of elements you have in the arrays and number should be the same for both the arrays
<br />
for (i=0;i < NO_OF_ELEMENTS;i++)<br />
{<br />
}<br />
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
|
|
|
|
|
In different format, but sometimes preferable (although it is a matter of taste)
for(int i=0, j=N-1; i<N; ++i,--j)
a[i].operation_on(b[j]);
use two indexes, but does not recalculate the offsets.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
for (i=0;i < NO_OF_ELEMENTS;i++)
{
m_stArray[NO_OF_ELEMENTS-i -1 ].SetWindowText (m_strArray[i]);
}
|
|
|
|
|