aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/JSAPI2_svc_apicreator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Winamp/JSAPI2_svc_apicreator.h')
-rw-r--r--Src/Winamp/JSAPI2_svc_apicreator.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/Src/Winamp/JSAPI2_svc_apicreator.h b/Src/Winamp/JSAPI2_svc_apicreator.h
new file mode 100644
index 00000000..f88efe00
--- /dev/null
+++ b/Src/Winamp/JSAPI2_svc_apicreator.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <bfc/dispatch.h>
+#include <bfc/std_mkncc.h>
+#include <ocidl.h>
+#include "jsapi2_api_security.h"
+#include "JSAPI_Info.h"
+
+namespace JSAPI2
+{
+ class svc_apicreator : public Dispatchable
+ {
+ public:
+ enum
+ {
+ AUTHORIZATION_UNDEFINED = 0x0,
+ AUTHORIZATION_ALLOW = 0x1,
+ AUTHORIZATION_DENY = 0x2,
+
+ AUTHORIZATION_MASK = 0xFFF,
+
+ AUTHORIZATION_FLAG_ALWAYS = 0x1000,
+ AUTHORIZATION_FLAG_ALWAYS_FOR_SERVICE = 0x2000,
+ AUTHORIZATION_FLAG_GROUP_ONLY = 0x4000,
+ };
+ public:
+ static FOURCC getServiceType() { return MK4CC('j','s','a','c'); }
+ // this key is guaranteed to out-live your object, so you can just save the pointer
+ // also, DO NOT add a reference to the info object or else you will create a circular reference
+ IDispatch *CreateAPI(const wchar_t *name, const wchar_t *key, JSAPI::ifc_info *info);
+
+ // returns new AUTHORIZATION_* enum to save to settings, or AUTHORIZATION_UNDEFINED if this isn't our API
+ int PromptForAuthorization(HWND parent, const wchar_t *group, const wchar_t *action, const wchar_t *authorization_key, JSAPI2::api_security::AuthorizationData *data);
+ enum
+ {
+ JSAPI2_SVC_APICREATOR_CREATEAPI = 0,
+ JSAPI2_SVC_APICREATOR_PROMPTFORAUTHORIZATION = 1,
+ };
+ };
+
+}
+
+inline IDispatch *JSAPI2::svc_apicreator::CreateAPI(const wchar_t *name, const wchar_t *key, JSAPI::ifc_info *info)
+{
+ return _call(JSAPI2_SVC_APICREATOR_CREATEAPI , (IDispatch *)0, name, key, info);
+}
+
+inline int JSAPI2::svc_apicreator::PromptForAuthorization(HWND parent, const wchar_t *group, const wchar_t *action, const wchar_t *authorization_key, JSAPI2::api_security::AuthorizationData *data)
+{
+ return _call(JSAPI2_SVC_APICREATOR_PROMPTFORAUTHORIZATION, (int)AUTHORIZATION_UNDEFINED, parent, group, action, authorization_key, data);
+}