1
0
Files
wfassoc/wfassoc/wfassoc.h
2022-02-01 10:54:27 +08:00

103 lines
3.9 KiB
C

#if !defined(_YYCDLL_WFASSOC_H__IMPORTED_)
#define _YYCDLL_WFASSOC_H__IMPORTED_
#include <Windows.h>
#include <sal.h>
#define WFVERSION 0
#define WFSUCCESS(expr) (!expr)
#define WFFAILED(expr) expr
/// <summary>
/// wfassoc Error Enum
/// </summary>
typedef enum _WFERROR {
/// <summary>
/// All operation done successfully
/// </summary>
WFERROR_OK = 0,
/// <summary>
/// The filed `WFVersion` in Profile Struct is not matched. It usually mean that currently used DLL is not matched with the DLL when compiling this application.
/// </summary>
WFERROR_INVALID_VERSION = 1,
/// <summary>
/// The buffer in some operations is insufficient, please try expanding buffer.
/// </summary>
WFERROR_INSUFFICIENT_BUFFER = 2,
/// <summary>
/// Some essential pointer variable is NULL
/// </summary>
WFERROR_NULLPTR = 3
}WFERROR;
/// <summary>
/// wfassoc Wide Character Set Profile Struct
/// </summary>
typedef struct _WFAPP_PROFILEW {
/// <summary>
/// wfassoc version. Fill it with `WFVERSION` in your application. This field is used for version checking.
/// </summary>
INT WFVersion;
/// <summary>
/// The path to locate your application.
/// </summary>
WCHAR* AppPath;
/// <summary>
/// The command will be executed when opening files.
/// </summary>
WCHAR* AppCommand;
/// <summary>
/// Your application's ProgID.
/// For more detail about how to create your ProgID, please browse: https://docs.microsoft.com/en-us/windows/win32/shell/fa-progids
/// We also provide a generator for creating legacy ProgID. Use `WFGenerateProgID` to create a legacy ProgID.
/// </summary>
WCHAR* ProgID;
/// <summary>
/// Your application supported file extensions.
/// The structure of this field is connecting all supported extensions with dot(.) end to end. For example:
/// `.jpg\0.png\0.gif\0`
/// </summary>
WCHAR* SupportedTypes;
}WFAPP_PROFILEW;
/// <summary>
/// wfassoc Narrow Character Set Profile Struct
/// </summary>
typedef struct _WFAPP_PROFILEA {
INT WFVersion;
CHAR* ApplicationName;
CHAR* SupportedTypes;
}WFAPP_PROFILEA;
/// <summary>
/// Install Application via Wide Character
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
WFERROR WFInstallApplicationW(WFAPP_PROFILEW* profile);
WFERROR WFInstallApplicationA(WFAPP_PROFILEA* profile);
WFERROR WFUninstallApplicationW(WFAPP_PROFILEW* profile);
WFERROR WFUninstallApplicationA(WFAPP_PROFILEA* profile);
/// <summary>
/// Generate Legacy ProgID
/// </summary>
/// <param name="vendor">Vendor. Such as `Word`, `Excel`, `PowerPoint`.</param>
/// <param name="component">Component. Such as `Document`, `Sheet`, `Diagram`.</param>
/// <param name="version">Version. Such as `0`, `1`, `114514`.</param>
/// <param name="result">Pointer to output ProgID. If this variable is NULL, function will calculate proper length of receiving buffer and return it via `result_length`.</param>
/// <param name="result_length">Pointer to a int variable containing buffer's length. If `result` is not NULL, it should be the length of `result`.</param>
/// <returns></returns>
WFERROR WFGenerateProgIDW(WCHAR* vendor, WCHAR* component, INT version, WCHAR* result, INT* result_length);
/// <summary>
/// Generate Legacy ProgID
/// </summary>
/// <param name="vendor">Vendor. Such as `Word`, `Excel`, `PowerPoint`.</param>
/// <param name="component">Component. Such as `Document`, `Sheet`, `Diagram`.</param>
/// <param name="version">Version. Such as `0`, `1`, `114514`.</param>
/// <param name="result">Pointer to output ProgID. If this variable is NULL, function will calculate proper length of receiving buffer and return it via `result_length`.</param>
/// <param name="result_length">Pointer to a int variable containing buffer's length. If `result` is not NULL, it should be the length of `result`.</param>
/// <returns></returns>
WFERROR WFGenerateProgIDA(CHAR* vendor, CHAR* component, INT version, CHAR* result, INT* result_length);
#endif