-
Notifications
You must be signed in to change notification settings - Fork 23
/
IDolphinStart.cpp
executable file
·76 lines (57 loc) · 1.59 KB
/
IDolphinStart.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _DEBUG
#pragma optimize("s", on)
#pragma auto_inline(off)
#endif
#include "ist.h"
#include "rc_vm.h"
#include "DolphinSmalltalk_i.h"
#include "DolphinSmalltalk.h"
#include "Utf16StringBuf.h"
extern HINSTANCE hApplicationInstance;
static IDolphin* piVM=NULL;
IDolphin* GetVM()
{
return piVM;
}
/////////////////////////////////////////////////////////////////////
// IDolphinSmalltalk
STDMETHODIMP CDolphinSmalltalk::Initialise(HINSTANCE hInstance,
LPCSTR fileName, LPVOID imageData, UINT imageSize,
DWORD dwFlags)
{
if (fileName == nullptr)
return Initialise(hInstance, (LPCWSTR)nullptr, imageData, imageSize, dwFlags);
else
{
Utf16StringBuf buf(0, fileName, strlen(fileName));
return Initialise(hInstance, (LPCWSTR)buf, imageData, imageSize, dwFlags);
}
}
STDMETHODIMP CDolphinSmalltalk::Initialise(HINSTANCE hInstance,
LPCWSTR fileName, LPVOID imageData, UINT imageSize,
DWORD dwFlags)
{
HRESULT APIENTRY VMInit(LPCWSTR szImageName, LPVOID, UINT, DWORD);
if (hInstance == NULL)
return E_INVALIDARG;
piVM = this;
Lock();
hApplicationInstance = hInstance;
HRESULT hr = VMInit(fileName, imageData, imageSize, dwFlags);
Unlock();
return hr;
}
STDMETHODIMP CDolphinSmalltalk::Run(IUnknown* punkOuter)
{
extern int APIENTRY VMRun(DWORD);
piVM = this;
Lock();
HRESULT hr = VMRun(reinterpret_cast<DWORD>(punkOuter));
Unlock();
return hr;
}
STDMETHODIMP CDolphinSmalltalk::GetVersionInfo(LPVOID pvi)
{
extern BOOL __stdcall GetVersionInfo(VS_FIXEDFILEINFO* lpInfoOut);
return ::GetVersionInfo(static_cast<VS_FIXEDFILEINFO*>(pvi)) ? S_OK : E_FAIL;
}