| 1 | #pragma once |
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 3 | |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | #define ReleaseIni(ih) if (ih) { IniUninitialize(ih); } |
| 10 | #define ReleaseNullIni(ih) if (ih) { IniUninitialize(ih); ih = NULL; } |
| 11 | |
| 12 | typedef void* INI_HANDLE; |
| 13 | typedef const void* C_INI_HANDLE; |
| 14 | |
| 15 | extern const int INI_HANDLE_BYTES; |
| 16 | |
| 17 | struct INI_VALUE |
| 18 | { |
| 19 | LPCWSTR wzName; |
| 20 | LPCWSTR wzValue; |
| 21 | |
| 22 | DWORD dwLineNumber; |
| 23 | }; |
| 24 | |
| 25 | HRESULT DAPI IniInitialize( |
| 26 | __out_bcount(INI_HANDLE_BYTES) INI_HANDLE* piHandle |
| 27 | ); |
| 28 | void DAPI IniUninitialize( |
| 29 | __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle |
| 30 | ); |
| 31 | HRESULT DAPI IniSetOpenTag( |
| 32 | __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 33 | __in_z_opt LPCWSTR wzOpenTagPrefix, |
| 34 | __in_z_opt LPCWSTR wzOpenTagPostfix |
| 35 | ); |
| 36 | HRESULT DAPI IniSetValueStyle( |
| 37 | __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 38 | __in_z_opt LPCWSTR wzValuePrefix, |
| 39 | __in_z_opt LPCWSTR wzValueSeparator |
| 40 | ); |
| 41 | HRESULT DAPI IniSetValueSeparatorException( |
| 42 | __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 43 | __in_z LPCWSTR wzValueNamePrefix |
| 44 | ); |
| 45 | HRESULT DAPI IniSetCommentStyle( |
| 46 | __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 47 | __in_z_opt LPCWSTR wzLinePrefix |
| 48 | ); |
| 49 | HRESULT DAPI IniParse( |
| 50 | __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 51 | __in LPCWSTR wzPath, |
| 52 | __out_opt FILE_ENCODING *pfeEncodingFound |
| 53 | ); |
| 54 | // Gets the full value array, this includes values that may have been deleted |
| 55 | // (their value will be NULL) |
| 56 | HRESULT DAPI IniGetValueList( |
| 57 | __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 58 | __deref_out_ecount_opt(*pcValues) INI_VALUE** prgivValues, |
| 59 | __out DWORD *pcValues |
| 60 | ); |
| 61 | HRESULT DAPI IniGetValue( |
| 62 | __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 63 | __in LPCWSTR wzValueName, |
| 64 | __deref_out_z LPWSTR* psczValue |
| 65 | ); |
| 66 | HRESULT DAPI IniSetValue( |
| 67 | __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 68 | __in LPCWSTR wzValueName, |
| 69 | __in_z_opt LPCWSTR wzValue |
| 70 | ); |
| 71 | HRESULT DAPI IniWriteFile( |
| 72 | __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle, |
| 73 | __in_z_opt LPCWSTR wzPath, |
| 74 | __in FILE_ENCODING feOverrideEncoding |
| 75 | ); |
| 76 | |
| 77 | #ifdef __cplusplus |
| 78 | } |
| 79 | #endif |