How to invoke NdrClientCall2() function directly? - windows

Does anybody know how the NdrClientCall2() function in rpcrt4.dll can be called in code or how it can be used?
We've gone through the MSDN help -
http://msdn.microsoft.com/en-us/library/aa374215(VS.85).aspx,
but didn't get any examples/samples how to use this function.
Please provide help.
Thank you.

Typically you don't ever call it directly - it requires a huge set of parameters prepared in a special barely-manageable way. Instead you use IDL to specify your RPC interface, compile it with MIDL and this gives you a client proxy that calls that function with proper parameters.

The easiest would be to use and idl-file and use midl.exe to generate the client RPC stub, which utilizes the NdrClientCall2 internally.

This is normally called via the RPC client MIDL code - why do you want to call this directly?

Related

Using CSOM in VBS [duplicate]

I've compiled C# code into a DLL, but have little experience with them. My C# code contains a class HelloWorld with a static method Print(). I'd like to use this DLL in VBScript to call the method Print(). I know this is base, but I'm using this as a test for a larger scale project that will be compiled to DLL in the end. What's the declare look like for that and how would the method call look?
Important: Both methods will work only if the DLL exposes a COM interface.
If your dll is registered with the system, use CreateObject with it's ProgID.
Set myObject = CreateObject("MyReallyCoolObject.HelloWorld")
myObject.Print
If your object is not registered on the system, use GetObject with a path to the file containing your object. Make sure your object exposes the proper interface. (The second parameter is optional. Here you can provide a class name if your object exposes more than one.)
Set myObject = GetObject("C:\some\path\helloworld.dll", "appname.HelloWorld")
myObject.Print
I think you might be looking for Registration-Free COM. This SO answer regarding the Microsoft.Windows.ActCtx should help specifically for VBScript.
Keep in mind that COM doesn't support static methods, so you'll have to make your Print method into an instance method.
How to call a .NET DLL from a VBScript

Is there any way to call a library from a client side user interface?

I'm building a user interface in HTML Service for Google Apps Script and I want to be able to call functions from a library that is loaded in the server side .gs file of my script. The client side call to the server side library does not seem to work. Is this possible to do?
I'm pretty new to javascript/apps script so excuse me if I'm mis-stating what's happening here.
UPDATE: Here's the solution I used
On the container bound script:
function libraryHandler(functionName){
return eval("libraryIdentifier." + functionName);
}
In the library:
google.script.run.libraryHandler('myLibraryFunctionName(param1,param2,etc.)')
Make a "dummy" function in the same script where the html is. Make that dummy call your library function.

In WCS, can we invoke a controller command from within a jsp ? If yes, please explain the different methods

From what I've heard, A controller command can be invoked from within a scriptlet. But I am not sure of other methods. Any code level information would be very helpful.
You can also try making AJAX call from the JSP to the controller command.
You really shouldn't be directly executing a controller command from within the scriptlet code of a JSP. You could use AJAX to call a command service. Or you could use a DataBean Command, though they are really meant to be commands that populate the databean not really call controller commands. You may also be in a situation that you need to review your use of a controller command, possibly BOD commands would be a better fit if you are wanting to invoke a service from the JSP during the page generation.
You could create your own mapping of your ControllerCommand to REST.
http://www-01.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.webservices.doc/tasks/twvrestsamplecmd.htm
Then you use the REST tag to run the ControllerCommand.
http://www-01.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.component-services.doc/refs/rwvwcfresttag.htm
In the new implementation from IBM in FEP8 this will be done locally if possible and will therefor not add any extra network overhead.
By Using Databean also we can invoke controller commands.
ex : <wcbase:usebean>

Executing controllers methods from a library in codeigniter

i have a question, i am developing a library for Codeigniter to create Job Queues with workers and delayed queue (Codeigniter-JobQueue). But i have a question...
... How can i perform or execute controller's methods inside this library? It will be awesome to know this.
The library is taking "controller, method, params" to transform after to "http://www.example.com/controller/method/params".
Thanks, and if you want to help me to develop, you are welcome. ;)
Use curl. If you however expect a return variable from controllers method, then C in your MVC is not designed properly.
Curl is a way to go. Controllers should output content and not return a variable. If you are scheduling any job, the library should call the URL itself. You could use the cli mode of codeigniter.
http://ellislab.com/codeigniter/user-guide/general/cli.html

how to hook a specific API on Windows with SetWindowsHookEx?

I am trying to hook an API (say, MessageBox()) in other processes (I may not know the process ID) on Windows, I know that I have to use the SetWindowsHookEx() function. But still, I have three questions:
1) Can SetWindowsHookEx() function makes the hook global, i.e., not limited to current process? (When ther applications call this API, it is hooked?)
2) If I want to replace the to-be-hooked API with my own function, how should I do?
3) I read many materials, and I found the term "hook procedure" or "hook function". How should I comprehend this? Currently, I take it as the function that I will use to replace the API (say again, MessageBox).
This is not what SetWindowsHookEx is for. SetWindowsHookEx is for hooking into windows messages, not APIs (for example if you want to know when a window changes size or gets created).
Hooking API calls is more complicated, more messy. There is no built-in way to do it; you usually want to find a library to help you such as Detours.
You can use Deviare API Hook for this. With this library you can hook any API in 10 lines of code even with .NET
The difference with Detours is that you don't have to write the code that is inserted in each process. You can hook all the processes you want just attaching them. Then, you receive the calls in your own process.

Resources