Yes as suggested I can use MessageBox API for this rtcMsgBox API.But there are many exported functions like this in msvbvm60.dll as you said for which I may not be knowing equivalent in c and therefore for using them we have to use
them directly like rtcMsgBox.
...functions like this in msvbvm60.dll ... for which I may not be knowing equivalent in c
The background behind 'the tricks' question above is,
that nearly all the functions of msvbvm60.dll are covered already by "system-layer-Dlls",
like User32, Ole32, OleAut32...
For example the VB6-Format(...)-Function is contained in oleaut32.dll, described here: https://docs.microsoft.com/en-us/win...auto-varformat
(along with a whole lot of other "Variant-Conversion-Functions", when you look at the left-hand-side of that MSDN-Page).
And as for the few functions wich are not covered - like e.g. GetMem4,
come on - you're working in C...
"copying 4 Bytes around" should be a childsplay using a bit of "C-Pointer-voodoo".
Hello The Trick,
In msvbvm60.dll I have seen export functions like
EbLoadRunTime
EbCreateContext
Can these type of functions along with coinitialize which you showed in c code of help to initialize STA, runtime and project context. as you said You need to initialize STA, runtime and project context. so that we can make the rtcMsgBox to run without using VB AX dll.
Hello The Trick,
In msvbvm60.dll I have seen export functions like
EbLoadRunTime
EbCreateContext
Can these type of functions along with coinitialize which you showed in c code of help to initialize STA, runtime and project context. as you said You need to initialize STA, runtime and project context. so that we can make the rtcMsgBox to run without using VB AX dll.
They start with rtc or Eb or _ or VBDll or DLLGet or Get or Tip etc.
For GetMemX there is c rtlmovememory.
For rtcMsgBox there is c MessageBox. etc
For DLLGetxxx there is c DLLGetxxx
For Eb ???
For VBDll ???
For Tip ???
For _ ???
So there are different types of exports.
Is there any other way that I could manually init STA,project context,runtime ie simulate the vb AX dll functionality so that I can use export functions of msvbvm60.dll if I know the declaration of the export function.
No. rtcMsgBox has different behavior when you have unattended execution option in a project.
Originally Posted by smkperu
For Eb ???
For VBDll ???
For Tip ???
For _ ???
You don't need the most of functions outside VB6-application especially in C.
Originally Posted by smkperu
Is there any other way that I could manually init STA,project context,runtime ie simulate the vb AX dll functionality so that I can use export functions of msvbvm60.dll if I know the declaration of the export function.
Yes, there is a way to do manual initialization but i don't see reason to show it. This question looks like bunch of messages which i regularly get from script-kiddie-malware-developers which want to "bypass AV" etc. So if you want i help you to solve your issue you should explain (clear) why you want to use that method.
For initializing project instead of using separate VB Ax Dll can we use the same msvbvm60.dll for
initializing STA and create a VB6 AxDll object so that overhead may be reduced.
For initializing project instead of using separate VB Ax Dll can we use the same msvbvm60.dll for
initializing STA and create a VB6 AxDll object so that overhead may be reduced.
Thanks.
Dear smkperu,
If you want to use msvbvm60.dll instead of a new activex dll there are two ways to initialize project:
1. Identifying a multiuse class from msvbvm60.dll activex dll and creating its instance using cocreateinstance after calling coinitialize just as shown by Trick in his C code.
or
2. Getting the VBHeader(EXEProjectInfo) structure from the msvbvm60.dll thru its module instance which you already have thru LoadLibrary("msvbvm60.dll") and calling VBDllGetClassObject( by passing the VBHeader as one of input parameters to it ) after calling coinitialize in same C code.
I donot know about the manual project initialization which only Trick can help.
I made a simple win32 console c/c++ application which takes any .exe file and runs it from memory.It is similar to your Patcher vb6 application of VBLoader which loads a .exe into memory and removes the runtime without running it.
Can you show me how to add runtime to the .exe given as input to the above c/c++ console application using functions like
AddRuntimeToIAT similar to RemoveRuntimeFromIAT(of Patcher app of VBLoader) FillRuntimeImport similar to ClearRuntimeImport(of Patcher app of VBLoader )
So that in addition I can add runtime and then run my .exe in memory using the above c/c++ console app so that I can display rtcMsgBox properly.
There is nothing exported from msvbvm60.dll which cannot be done in "normal fashion" from C/C++ so using rtcMsgBox is hilarious at least.
This whole thread looks like a very unhealthy interest in VB6 runtime.
cheers,
</wqw>
This isn't my thread. A moderator extracted the messages from another thread to this separate thread. Just i was surprised when I saw the thread i've created in this forum-section.
You haven't explained why you really need it. It's look like a "malware".
Hello The Trick,
I donot know what to answer.
I already explained the need that when I am already using dll(msvbvm60.dll) can I avoid using another vb6 Ax dll since one dll is better than using two since it avoids the overhead of using another dll.
JSVenu has suggested a way to use msvbvm60.dll directly instead of a second VB Ax dll which I could not understand.
from which based on your patch application for removing runtime I developed a simple Win32 c/c++ console app for which if we can add runtime to input .exe we could run the said rtc... API calls properly.
I already explained the need that when I am already using dll(msvbvm60.dll) can I avoid using another vb6 Ax dll since one dll is better than using two since it avoids the overhead of using another dll.
JSVenu has suggested a way to use msvbvm60.dll directly instead of a second VB Ax dll which I could not understand.
Smkperu, DLLs can (and often do) have dependencies just like our main program can. I don't know for sure, but you're probably already loading up things like Kernel32.dll and User32.dll anyway, even if you're not directly referencing them. So, since they're loaded anyway, why not just directly use them? That sort of obviates your explanation.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
I already explained the need that when I am already using dll(msvbvm60.dll) can I avoid using another vb6 Ax dll since one dll is better than using two since it avoids the overhead of using another dll.
JSVenu has suggested a way to use msvbvm60.dll directly instead of a second VB Ax dll which I could not understand.
from which based on your patch application for removing runtime I developed a simple Win32 c/c++ console app for which if we can add runtime to input .exe we could run the said rtc... API calls properly.
Thanks
Hello The Trick,
I tried to add the msvbvm60.dll imports using PE editor tool for a simple vb6 standard exe application which calls rtcMsgBox for which the runtime was removed using patcher of vbloader.The application worked fine.
I also tried your c/c++ application which worked fine after initializing project using coinitialize and cocreateinstance.
I tried this even in new thread using createthread api for which even in the new thread function it works fine only after initializing project using coinitialize and cocreateinstance.
I understood that adding runtime imports only works for main thread and not for new threads.
Can you show me an API like EbLoadRuntime which works for new thread in vb6 and which can be used in c/c++ in any thread for initializing project so that I can display rtc... APIs without crash.
What are the parameters of EbLoadRuntime and what is usage of it.
How can I use the above API if possible or any other APIs in vb6 as well as c/c++ so that the project is initialized properly for displaying rtc... APIs.
You have shown me how to use undocumented rtcMsgBox API of msvbvm60.dll properly using parameters properly.
As per your guidance in the link https://www.vbforums.com/showthread....=1#post5548715 the following is a simple working example which displays msgbox using undocumented rtcMsgBox API of msvbvm60.dll in c/c++ win32 console application as follows:
Code:
#include <stdio.h>
#include <windows.h>
#include <ole2.h>
#include <objbase.h>
// Exported VB function
typedef LONG (__stdcall * PFUNC)(VARIANT *,LONG,VARIANT*,VARIANT*,VARIANT*);
int main(int argc, char* argv[])
{
HINSTANCE hMod = 0;
IUnknown *x=NULL;
PFUNC pFunc = NULL;
VARIANT x1,x2,x3,x4;
LPWSTR guidstr;
GUID guid;
CLSID clsid;
HRESULT hr;
MSG msg;
DWORD id;
LPOLESTR p;
p = OLESTR("vbrtc22.Class1");//actx dll vbrtc22 with empty dummy multiuse class Class1 and the vbrtc22.dll should
//be in the same folder as c/c++ console app exe
//"Getting Clsid from string name
hr = CLSIDFromProgID( p ,&guid);
if( hr != S_OK ){
//Failed to get Clsid from string");
return 1;
}
//initialize STA
if (SUCCEEDED(CoInitialize(NULL)))
//initialize project
if (SUCCEEDED(CoCreateInstance(&guid,NULL,CLSCTX_INPROC_SERVER,&IID_IUnknown,&x)))
{
x1.vt = VT_BSTR;
x1.bstrVal = SysAllocString(L"Hello world1");
printf( "lib rtcMsgBox\n");
x2.vt=x3.vt=x4.vt=VT_ERROR;//new change
x2.scode=x3.scode=x4.scode=DISP_E_PARAMNOTFOUND;
// Load the VB DLL:
hMod = LoadLibrary("msvbvm60.dll");
if (hMod)
{
// Call the export:
pFunc = (PFUNC)GetProcAddress(hMod, "rtcMsgBox");
if (pFunc)
{
printf( " rtcMsgBox msvbvm\n");
pFunc(&x1,0,&x2,&x3,&x4);
printf( " rtcMsgBox after\n");
VariantClear(&x1);
} else
printf("proc not found rtcMsgBox\n");
FreeLibrary (hMod);
} else
printf("error lib\n");
}
return 0;
}
Similarly can you show how to use VBDllGetClassObject undocumented API of msvbvm60.dll in the above console application just like rtcMsgBox properly without crash after which I shall mark as my query resolved.I don't mind whether
it is treated as vb6 or moved to c/c++ forum.
source code for both c/c++ win32 console app and vbrtc22 actx dll app attached in vbrtc22.zip
When we use the following code c/c++ console app code the MsgBox is displayed.
Code:
#include <stdafx.h>
#include <stdio.h>
#include <windows.h>
#include "msvbvm60.tlh"
//#include <ole2.h>
// Exported VB function
typedef LONG (__stdcall * PFUNC)(VARIANT *,LONG,VARIANT*,VARIANT*,VARIANT*);
IDispatch *IUnk=NULL;
int main(int argc, char* argv[])
{
HINSTANCE hMod = 0;
HINSTANCE hvb = 0;
IUnknown *x=NULL;
PFUNC pFunc = NULL;
PFUNC1 pFunc1 = NULL;
VARIANT x1,x2,x3,x4;
HRESULT hr;
int x1111=3;
int y;
CLSID clsid;
LPOLESTR p = OLESTR("VbActxDll.CMultiuseClass");
printf("\nInitilizing COM library for thread");
hr = CoInitialize(NULL);
printf("\nGetting Clsid Struc from string name");
hr = CLSIDFromProgID( p , &clsid);
if( hr != S_OK ){
printf("\nFailed to get Clsid from string");
return 1;
}
printf("\nCreating Instance of Specified Clsid");
// create an instance and get IDispatch pointer
hr = CoCreateInstance( clsid,
NULL,
CLSCTX_INPROC_SERVER,
IID_IDispatch ,
(void**) &IUnk
);
if ( hr != S_OK )
{
printf("\nCoCreate failed");
return 1;
}
//{
x1.vt = VT_BSTR;
x1.bstrVal = SysAllocString(L"Hello world1");
printf( "lib rtcMsgBox\n");
x2.vt=VT_ERROR;
x3.vt=VT_ERROR;
x4.vt=VT_ERROR;
x2.scode=DISP_E_PARAMNOTFOUND;
x3.scode=DISP_E_PARAMNOTFOUND;
x4.scode=DISP_E_PARAMNOTFOUND;
// Load the VB DLL:
hMod = LoadLibrary("msvbvm60.dll");//success
// hMod = LoadLibrary("user32.dll");//success
if (hMod)
{
// Call the export:
pFunc = (PFUNC)GetProcAddress(hMod, "rtcMsgBox");//success
if (pFunc)
{
printf( " rtcMsgBox msvbvm\n");
pFunc(&x1,0,&x2,&x3,&x4);//crashes without displaying msgbox
printf( " rtcMsgBox after\n");
VariantClear(&x1);
} else
printf("proc not found rtcMsgBox\n");
FreeLibrary (hMod);
} else
printf("error lib\n");
return 0;
}
Here we are creating instance of VbActxDllvb6 activex dll having multiuse class CMultiuseClass.
But when we use a ATL project Comobjvc and insert SimpleObject comobj
and then try to create instance of this comobj project as follows:
Code:
LPOLESTR p = OLESTR("Comobjvc.comobj");//does not work
printf("\nInitilizing COM library for thread");
hr = CoInitialize(NULL);
printf("\nGetting Clsid Struc from string name");
hr = CLSIDFromProgID( p , &clsid);
if( hr != S_OK ){
printf("\nFailed to get Clsid from string");
return 1;
}
printf("\nCreating Instance of Specified Clsid");
// create an instance and get IDispatch pointer
hr = CoCreateInstance( clsid,
NULL,
CLSCTX_INPROC_SERVER,
IID_IDispatch ,
(void**) &IUnk
);
the MsgBox is not displayed.
What is the difference between ATL simpleobject and vb6 activex dll multiuse class.
Can we create the same multiuse class functionality of vb6 in ATL or c/c++ so that the MsgBox can be displayed.
Please clarify?