1
0

first commit

This commit is contained in:
2022-02-01 10:54:27 +08:00
commit b93e5eaf5d
11 changed files with 1041 additions and 0 deletions

43
wfassoc/wfassoc.c Normal file
View File

@ -0,0 +1,43 @@
#include "wfassoc.h"
#include <strsafe.h>
#define LEGACY_PROGID_FORMATA "%s.%s.%d"
#define LEGACY_PROGID_FORMATW L"%s.%s.%d"
WFERROR WFInstallApplicationW(WFAPP_PROFILEW* profile) {
return WFERROR_OK;
}
WFERROR WFInstallApplicationA(WFAPP_PROFILEA* profile) {
return WFERROR_OK;
}
WFERROR WFUninstallApplicationW(WFAPP_PROFILEW* profile) {
return WFERROR_OK;
}
WFERROR WFUninstallApplicationA(WFAPP_PROFILEA* profile) {
return WFERROR_OK;
}
WFERROR WFGenerateProgIDW(WCHAR* vendor, WCHAR* component, INT version, WCHAR* result, INT* result_length) {
if (result_length == NULL) return WFERROR_NULLPTR;
if (result == NULL) {
*result_length = _snwprintf(NULL, 0, LEGACY_PROGID_FORMATW, vendor, component, version) + 1;
} else {
int write_result = _snwprintf(result, *result_length, LEGACY_PROGID_FORMATW, vendor, component, version);
if (write_result < 0 || write_result >= *result_length) return WFERROR_INSUFFICIENT_BUFFER;
}
return WFERROR_OK;
}
WFERROR WFGenerateProgIDA(CHAR* vendor, CHAR* component, INT version, CHAR* result, INT* result_length) {
if (result_length == NULL) return WFERROR_NULLPTR;
if (result == NULL) {
*result_length = _snprintf(NULL, 0, LEGACY_PROGID_FORMATA, vendor, component, version) + 1;
} else {
int write_result = _snprintf(result, *result_length, LEGACY_PROGID_FORMATA, vendor, component, version);
if (write_result < 0 || write_result >= *result_length) return WFERROR_INSUFFICIENT_BUFFER;
}
return WFERROR_OK;
}