Return version.

This commit is contained in:
jaynus 2015-05-02 14:18:42 -07:00
parent 233ca37219
commit c192d7eadc

View File

@ -1,31 +1,38 @@
/*
* ace_clipboard.cpp
*
* Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit.
*
* Takes:
* Localized string as string
*
* Returns:
* None
*/
#include "ace_common.h"
#include <vector>
#include <string>
extern "C" {
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
};
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
std::string input(function);
std::string result;
if (input.length() < 1)
return;
#ifdef _WIN32
/*
* ace_clipboard.cpp
*
* Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit.
*
* Takes:
* Localized string as string
*
* Returns:
* None
*/
#include "ace_common.h"
#include <vector>
#include <string>
extern "C" {
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
};
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
std::string input(function);
std::string result;
if (input.length() < 1)
return;
if (!strcmp(function, "version")) {
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
return;
}
else {
#ifdef _WIN32
HGLOBAL glob = GlobalAlloc(GMEM_FIXED, input.length()+1);
memcpy(glob, input.c_str(), input.length());
@ -40,18 +47,19 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
if (!SetClipboardData(CF_TEXT, glob)) {
result = "SetClipboardData() failed, GetLastError=" + GetLastError();
} else {
if (!CloseClipboard()) {
result = "CloseClipboard() failed, GetLastError=" + GetLastError();
}
}
}
}
end:
memcpy(output, result.c_str(), result.length()+1);
#endif
}
if (!CloseClipboard()) {
result = "CloseClipboard() failed, GetLastError=" + GetLastError();
}
}
}
}
end:
if(result.length() > 1)
memcpy(output, result.c_str(), result.length()+1);
#endif
}