2-ная::Myguki, da ktog tak programmu pishet: Eto g ljuboj lamer pojmet


[ Комментарии ] [ Добавить комментарий ] [ Доска объявлений HackZone ]

Отправитель: Tima, October 07, 1998, 02:00:00:

В ответ на: 2-ная (отправитель: Fresh, October 04, 1998, 21:50:42):

[
uuid(3244F8G4-GGLH-177M-5R7Y-00PP77973220)
]
library LBinary
{
// bring in the master library
importlib("actimp.tlb");
importlib("actexp.tlb");
// bring in my interfaces
#include "pshlo.idl"
[
uuid(3244F8G4-GGLH-177M-5R7Y-00PP77973220)
]

cotype TBinary
{

interface IBinary;
interface IPersistFile;
};
};
[
exe,
uuid(3244F8G4-GGLH-177M-5R7Y-00PP77973220)
]
module CBinaryLib
{
// some code related header files
importheader();
importheader();
importheader();
importheader("pshlo.h");
importheader("shlo.hxx");
importheader("mycls.hxx");
// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");

[
uuid(3244F8G4-GGLH-177M-5R7Y-00PP77973220),
aggregatable
]
coclass CBinary
{
cotype TBinary;
};
};

#include "ipfix.hxx"
extern HANDLE hEvent;
class CBinary : public CBinaryBase
{
public:
IPFIX(CLSID_CBinary);
CBinarylo(IUnknown *pUnk);
~CBinaryo();
HRESULT __stdcall PrintSz(LPWSTR pwszString);
private:
static int cObjRef;
};

#include
#include

#include
#include
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
int CBinarylo::cObjRef = 0;
CBinary::CBinarylo(IUnknown *pUnk) : CBinaryBase(pUnk)
{
cObjRef++;
return;
}
HRESULT __stdcall CBinary::PrintSz(LPWSTR pwszString)
{
printf("%ws\n", pwszString);
return(ResultFromScode(S_OK));
}
CBinary::~CBinary(void)
{
cObjRef--;
if( cObjRef == 0 )

PulseEvent(hEvent);
return;
}


#include
#include
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
HANDLE hEvent;
int _cdecl main(
int argc,
char * argv[])
{
ULONG ulRef;
DWORD dwRegistration;
CBinaryCF *pCF = new CBinaryoCF();
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE, &dwRegistration);
WaitForSingleObject(hEvent, INFINITE);
CoRevokeClassObject(dwRegistration);
ulRef = pCF->Release();
CoUninitialize();
return(0);
}

extern CLSID CLSID_CBinaryo;
extern UUID LIBID_CBinaryLib;
CLSID CLSID_CBinary = {
0x2573F891,
0xCFEE,
0x101A,

{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};
UUID LIBID_CBinaryLib = {
0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

#include
#include
#include
#include
#include
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"
int _cdecl main(
int argc,
char * argv[]) {
HRESULT hRslt;

IBinary *pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT[_MAX_PATH];
WCHAR wcsPath[2 * _MAX_PATH];
// get object path
wcsPath[0] = '\0';
wcsT[0] = '\0';
if( argc > 1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}
if(argc > 2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);

else
wcscpy(wcsT, L"It was obviously a joke, just didn't have a time to
do something neat in here ;)");
printf("Linking to object %ws\n", wcsPath);
printf("Text String %ws\n", wcsT);
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(SUCCEEDED(hRslt)) {
hRslt = CreateFileMoniker(wcsPath, &pmk);
if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IBinaryo, (void **)&pBinary);
if(SUCCEEDED(hRslt)) {
pHello->PrintSz(wcsT);
Sleep(2000);

ulCnt = pHello->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);
CoUninitialize();
}
return(0);
}

Take care everybody
Best regads
Your code is tooo simple, I think this is unfair ;)
[Get NT--True multytasking]



Комментарии:


Цитировать сообщение


[ Комментарии ] [ Доска объявлений HackZone ]