Documentation for CodeAuthzpComputeImageHash - winapi

Can anyone point me to documentation for CodeAuthzpComputeImageHash() in advapi32.dll?
I can't seem to find documentation anywhere.

The reason you can't find documentation for this function is that this function is undocumented.
Not all winapi functions are documented, unfortunately.
There is a mention of the function at http://technet.microsoft.com/en-us/library/cc786941(v=WS.10).aspx, though:
ItemData (REG_BINARY). The actual hash to the file. This value should always be 16 bytes and is generated with a call to CodeAuthzpComputeImageHash().
Also, you can use a trampoline to hook the function, and if you know how to cause it to be executed, you can then try to see its arguments and return type.
Also, try searching at WINE if they have implemented it. Ask in their mailing list. Since they try to implement winapi, they need to implement the undocumented parts, too, there's a good chance they have some understanding about the function.

Related

How can I defeat the Go optimizer in benchmarks?

In Rust, you can use the black_box function to force the compiler to
assume that the function's argument is used (forcing it not to optimize away code that generates that value)
not be able to inspect how its return value is produced (preventing it from doing constant-folding and other such optimizations).
Is there a similar facility in Go (to accomplish either task)?
Is there a similar facility in Go (to accomplish either task)?
No.
If you want to use a result: Assign to an exported global.
I believe runtime.KeepAlive is recommended, as per the following Github issue. Unfortunately, it's unclear whether anything exists for function arguments, or whether KeepAlive is even guaranteed to work.
https://github.com/golang/go/issues/27400

Where is officially explained "withVariable" View function?

I'm not sure this question should be asked here, but I don't know where else, so I hope it is not banned. And if it is, please address me to a place where it should be asked.
I know in Laravel you can pass a variable called "Bar" to a view like this:
view()->withBar('Foo');
but I don't know how do I know, and the most important, where is it 'officially' explained.
I can find it in the __call function in the code (https://github.com/laravel/framework/blob/5.4/src/Illuminate/View/View.php) but not in the official API.
So, where is it officially explained?
This use to be documented but it has hasn't been included in the docs since 5.0 https://laravel.com/docs/5.0/views#passing-data-to-views.
As with most things with Laravel there are usually a few different ways to do the exact same thing so (for whatever reason) somethings do eventually get omitted from the docs but the functionality doesn't get removed. I would imagine this is because it might be considered a bad practice or not the best approach or even that Taylor may eventually want to remove it...who knows. Either way, there is usually an alternative given to achieve the same outcome.
Hope this helps!

What exactly does SE_ERR_ASSOCINCOMPLETE mean?

I was unable to find any hint of the exact meaning of the SE_ERR_ASSOCINCOMPLETE ShellExecute return value.
I know that MSDN says "The file name association is incomplete or invalid", but what exactly does that mean? In what situations can it occur?
The best information on this can be found in the documentation. Which supplies the text:
The file name association is incomplete or invalid.
Which is what you've found out. To be honest it seems reasonably clear what it means, specifically that there is something wrong with the file association that has prevented the function from completing.
As to what SE_ERR_ASSOCINCOMPLETE means in full gory detail, that is an exhaustive list of all possible failure modes, you'll likely never find out. This is a deprecated function that exists solely to maintain backwards compatibility. The chances of Microsoft offering more insight into its works are vanishingly small.
The smart play here is not to call ShellExecute. Its error handling is crippled. Instead use ShellExecuteEx. When that fails, use GetLastError to get a Win32 error code.
Read more about that in Raymond Chen's article, Why does ShellExecute return SE_ERR_ACCESSDENIED for nearly everything? And then ask yourself what is the point of trying to gain a full understanding of the error codes that this function returns when most of the time you'll get SE_ERR_ACCESSDENIED.

On the use of of Internal`Bag, and any official documentation?

(Mathematica version: 8.0.4)
lst = Names["Internal`*"];
Length[lst]
Pick[lst, StringMatchQ[lst, "*Bag*"]]
gives
293
{"Internal`Bag", "Internal`BagLength", "Internal`BagPart", "Internal`StuffBag"}
The Mathematica guidebook for programming By Michael Trott, page 494 says on the Internal context
"But similar to Experimental` context, no guarantee exists that the behavior and syntax of the functions will still be available in later versions of Mathematica"
Also, here is a mention of Bag functions:
Implementing a Quadtree in Mathematica
But since I've seen number of Mathematica experts here suggest Internal`Bag functions and use them themselves, I am assuming it would be sort of safe to use them in actual code? and if so, I have the following question:
Where can I find a more official description of these functions (the API, etc..) like one finds in documenation center? There is nothing now about them now
??Internal`Bag
Internal`Bag
Attributes[Internal`Bag]={Protected}
If I am to start using them, I find it hard to learn about new functions by just looking at some examples and trial and error to see what they do. I wonder if someone here might have a more complete and self contained document on the use of these, describe the API and such more than what is out there already or a link to such place.
The Internal context is exactly what its name says: Meant for internal use by Wolfram developers.
This means, among other things, the following things hold about anything you might find in there:
You most likely won't be able to find any official documentation on it, as it's not meant to be used by the public.
It's not necessarily as robust about invalid arguments. (Crashing the kernel can easily happen on some of them.)
The API may change without notice.
The function may disappear completely without notice.
Now, in practice some of them may be reasonably stable, but I would strongly advise you to steer away from them. Using undocumented APIs can easily leave you in for a lot of pain and a nasty surprise in the future.

What algorithm does gcc use to convert calls through function pointers to direct calls?

I've heard that recent versions of gcc are very good at converting calls through function pointers to direct calls. However, I can't find anything about it on the web or the quick look through gcc's source code. Does anyone know if this is actually true and if so, what algorithm does it use to do this?
You might find this article interesting. It's dated 2005, and I'm not sure if that's 'recent' enough, but it deals with the subject comprehensively:
http://www.codeproject.com/KB/cpp/FastDelegate.aspx
It's just a form of value propagation. If I can prove that object pointer p (to a virtual calss) always points to an object of a particular concrete class, then I can call that class's member functions directly. If not, I have to go through the vtable.

Resources