NO

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
cast it
Code: [Select]
...
Baz=(const char**)&Foo;
...
clang:
Code: [Select]
warning: assigning to 'const char **' from 'char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
12
General discussions / Compiler's weird type check for pointers: bug or intended?
« Last post by dlOuOlb on July 10, 2019, 06:50:36 am »
The compiler does not allow to assign from a variable pointer to a constant pointer, like following:
Code: [Select]
int main(void)
{
    char *Foo="Hello.";
    const char *Bar;
    const char **Baz;

    Bar=Foo;
    Baz=&Bar;   //no warning, no error

    Baz=&Foo;   //error #2168

    return 0;
}
error #2168: Operands of '=' have incompatible types 'const char * *' and 'char * *'.

I know that Pelles C is strict at type check, but is it intended even for this case?
13
Bug reports / value of LDBL_EPSILON
« Last post by agoodeno on July 10, 2019, 04:22:48 am »
In float.h, the value of LDBL_EPSILON is given as equal to the DBL_EPSILON, just to more decimal places. I believe the correct value of LDBL_EPSILON (on IEEE 754 platforms) should be 1.084202172485504434007452e-19L.

My workaround is to add in my own .h file:
#undef LDBL_EPSILON
#define LBDL_EPSILON 1.084202172485504434007452e-19L

Hope to see this easy fix in the next version of Pelles C!

Alan
14
Work in progress / Re: fSDK© - Frankie's SDK for PellesC
« Last post by Abraham on July 01, 2019, 06:00:26 pm »
rpcdce.h

#ifndef DECLSPEC_NORETURN
#if (__POCC__ >= 800) & (__POCC_STDC_VERSION__ >= 201112L)
#define DECLSPEC_NORETURN   _Noreturn
#el
if (__POCC__ >= 500)
#define DECLSPEC_NORETURN   __declspec(noreturn)
#else
#define DECLSPEC_NORETURN
#endif
#endif

winnt.h

#ifndef DECLSPEC_NORETURN
#if (__POCC__ >= 800) & (__POCC_STDC_VERSION__ >= 201112L)
#define DECLSPEC_NORETURN   _Noreturn
#el
if (__POCC__ >= 260)
#define DECLSPEC_NORETURN   __declspec(noreturn)
#else
#define DECLSPEC_NORETURN
#endif
#endif

Not sure if anyone else place <stdnoreturn.h> before <windows.h>, but the rules require that the order of including standard headers should not break things.
15
User contributions / TrayIconDlg
« Last post by TimoVJL on June 30, 2019, 07:55:55 pm »
A simple example for TrayIcon API.
For those who want add that feature to own program.
16
Windows questions / Re: Working with WMI
« Last post by bitcoin on June 27, 2019, 05:23:17 pm »
Yes, it works! Thank you!  :)
Yesterday,I tried to do

Code: [Select]
VARIANT vcn3;
if (!(hr = pIWbemClassObject1->lpVtbl->Get(pIWbemClassObject1,L"ProcessId",0,&vcn3,NULL,NULL)))
{
TerminateProcess((void*)vcn3.intVal,0);
This shit don't works (unlike of your code). Thanks!
17
Windows questions / Re: Working with WMI
« Last post by TimoVJL on June 27, 2019, 11:23:47 am »
Maybe that 'blanket' is for RPC ?

An example to avoid notepad.exe running ;)
Code: [Select]
HRESULT STDMETHODCALLTYPE EventSink_Indicate(IWbemObjectSink *this, long lObjectCount, IWbemClassObject **apObjArray)
{
for (int i = 0; i < lObjectCount; i++)
{
printf("Event occurred %d/%d\n", i, lObjectCount);
IWbemClassObject *pIWbemClassObject = apObjArray[i];
//IWbemClassObject *pIWbemClassObject = *apObjArray;
VARIANT vcn;
HRESULT hr;
if (!(hr = pIWbemClassObject->lpVtbl->Get(pIWbemClassObject, L"__Class", 0, &vcn, NULL, NULL)))
{
if (vcn.vt == VT_BSTR)
printf("%ls\n", vcn.bstrVal);
VariantClear(&vcn);
}
else
printf("error: 0x%Xh\n", hr);
if (!(hr = pIWbemClassObject->lpVtbl->Get(pIWbemClassObject, L"TargetInstance", 0, &vcn, NULL, NULL)))
{
IUnknown *pUnk = vcn.punkVal;
IWbemClassObject *pIWbemClassObject1;
if (!(hr = pUnk->lpVtbl->QueryInterface(pUnk, &IID_IWbemClassObject, (void **)&pIWbemClassObject1)))
{
BOOL bFound = 0;
UINT pid;
VARIANT vcn1;
if (!(hr = pIWbemClassObject1->lpVtbl->Get(pIWbemClassObject1, L"Name", 0, &vcn1, NULL, NULL)))
{
printf("%ls\t", vcn1.bstrVal);
bFound = !wcscmp(vcn1.bstrVal, L"notepad.exe");
VariantClear(&vcn1);
}
VARIANT vcn2;
if (!(hr = pIWbemClassObject1->lpVtbl->Get(pIWbemClassObject1, L"Handle", 0, &vcn2, NULL, NULL)))
{
printf("%ls\n", vcn2.bstrVal);
pid = wcstoul(vcn2.bstrVal, 0, 10);
VariantClear(&vcn2);
}
if (bFound) {
printf("found: %d\n", pid);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
TerminateProcess(hProc, 0);
}

}
VariantClear(&vcn);
}
else
printf("error: 0x%Xh\n", hr);
}

return WBEM_S_NO_ERROR;
}
18
Windows questions / Re: Working with WMI
« Last post by bitcoin on June 25, 2019, 10:11:55 am »
Is call CoSetProxyBlanket required? Or I can skip it? I don't understand this api.
19
Windows questions / Re: Working with WMI
« Last post by bitcoin on June 24, 2019, 08:57:54 pm »
psapi could be another option for program.
In psapi I must call EnumProcesses (or what you mean) every 5 (or more/less ) seconds. So, it may be load processor or skip some process.
In WMI we have events..but COM is terrible hard.
20
Windows questions / Re: Working with WMI
« Last post by TimoVJL on June 24, 2019, 08:25:12 pm »
In my test, i used WaitForSingleObject(GetCurrentProcess(), INFINITE);

psapi could be another option for program.
Pages: 1 [2] 3 4 ... 10