Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C Sample #20

Open
sefai opened this issue Nov 16, 2016 · 13 comments
Open

C Sample #20

sefai opened this issue Nov 16, 2016 · 13 comments

Comments

@sefai
Copy link

sefai commented Nov 16, 2016

Hello all,

Is there a C sample?

Regards,

@mxmauro
Copy link
Contributor

mxmauro commented Nov 16, 2016

Hi. Pure C sample no but there are C++ ones.

@sefai
Copy link
Author

sefai commented Nov 17, 2016

Thank you @mxmauro

I am looking at the CTest sample. Command line parameters state that there is an option to add a Custom handler for each hook:

-ch=file: Custom handler to add to each hook (can be specified more than once).�

Is there a sample for this custom handler?

Regards,

@mxmauro
Copy link
Contributor

mxmauro commented Nov 17, 2016

Hi @sefai, yes you have RegistryPlugin sample. On C# you have Registry and FilePlugin. You can use them on CTest too.

@sefai
Copy link
Author

sefai commented Nov 17, 2016

@mxmauro I am sorry, but I couldn't understand what that plugin is doing.

I want to change the returned value (an _out parameter) from a kernel32 method call. How can I do this? Is there any guide or documentation that I can read so that I will stop distracting you?

Regards,

@sefai
Copy link
Author

sefai commented Nov 20, 2016

@mxmauro OK, I am making progress, I successfully changed the parameter. Now, I am trying to store some value on PreCall and use that value on PostCall. I see that there is WriteIntercallData and ReadIntercallData for that purpose, but I couldn't find any samples on how to use them. Can you help?

PS: By the way, the from at address http://forum.nektra.com/forum/ seems to be down. I can only search on it using Google Cache. Are you guys aware of it?

Regards,

@bo3b
Copy link

bo3b commented Aug 12, 2017

Still Dead! Google cache is now empty! WayBackMachine has no info! Terrific resource lost!

image

@Helios-vmg
Copy link

@bo3b I will look into it.

@bo3b
Copy link

bo3b commented Aug 13, 2017

Awesome, thank you for responding. I was worried that you had abandoned Deviare.

@vlucky
Copy link

vlucky commented Nov 2, 2017

nektra forum is still has the issue [SQL ERROR as above mentioned]. could anybody fix the issue, please?

Could you please provide C++ sample for custom dll (INktSpyMgr::LoadCustomDll) with functions exported and how to call & pass the string parameter in C++ client?

Currently I did the following:

custom DLL: exported function
__declspec(dllexport) HRESULT WINAPI fnCustom1(SIZE_T nParam1){
MessageBox(...);
}

in the client loaded the dll, (I can see load and unload events from LogPrint()), calling like,
CComVariant vtParam;
vtParam = L"This is text from client";
and calling lpSpyMgr->CallCustomApi() with (&vtParam) as one of parameter.

But this one not working. If I export function without parameters, I can call the function and see the message box from target process.

Thanks.

@vlucky
Copy link

vlucky commented Nov 30, 2017

Could anybody please reply?

@mxmauro
Copy link
Contributor

mxmauro commented Nov 30, 2017

Hi @vlucky,

You must provide a VT_I#/VT_UI#/VT_INT/VT_UINT or an array of VT_I#/VT_UI# (up to four items). You can create an array with SafeArrayCreateVector... i.e.:

VARIANT vt;

vt.vt = VT_ARRAY | VT_UINT;
vt.parray = SafeArrayCreateVector(VT_UINT, 0, 4)

And use SafeArray apis to store the values in the array before calling CallCustomApi

@vlucky
Copy link

vlucky commented Nov 30, 2017

Thanks @mxmauro ,

might be dumb question, but can I pass string too using above method?

@mxmauro
Copy link
Contributor

mxmauro commented Nov 30, 2017

No. Only integer values that the called function will receive. If you need to pass complex data, use VirtualAllocEx and WriteProcessMemory to write the data in the target process and pass the pointer as the parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants