From 71946280db9d7f35b70d80200cac1faa4729b2b0 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 12 Mar 2024 22:02:29 -0400 Subject: [PATCH 1/2] Add pre-commit and bunch of autofixes support --- .clang-format | 1 - .editorconfig | 19 ++ .github/workflows/docs.yml | 70 +++--- .github/workflows/main.yml | 128 +++++------ .isort.cfg | 2 +- .pre-commit-config.yaml | 41 ++++ .../mapi/src/mapi_headers/MAPIOID.h | 213 +++++++++--------- format_all.bat | 3 - win32/Demos/service/install/perf_install.ini | 26 +-- 9 files changed, 280 insertions(+), 223 deletions(-) create mode 100644 .editorconfig create mode 100644 .pre-commit-config.yaml delete mode 100644 format_all.bat diff --git a/.clang-format b/.clang-format index f58c56af9..9767e004c 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,6 @@ # A clang-format style that approximates Python's PEP 7 # Useful for IDE integration BasedOnStyle: Google -AlwaysBreakAfterReturnType: All AllowShortIfStatementsOnASingleLine: false AlignAfterOpenBracket: Align BreakBeforeBraces: Stroustrup diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..e6c222531 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +# TODO: Activate and run in a different PR. Lots of files affected +# trim_trailing_whitespace = true +# insert_final_newline = true +# end_of_line = crlf +indent_style = space +indent_size = 4 +max_line_length = 120 # Same as .clang-format + +[*.py] +max_line_length = 88 # Same as Black + +[*.md] +trim_trailing_whitespace = false + +[*.{yaml,yml}] +indent_size = 2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 45b77ff6e..68382491f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,68 +4,68 @@ on: create: tags: # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - - b[0-9][0-9][0-9] - - publish-docs* + - b[0-9][0-9][0-9] + - publish-docs* push: branches: - - main + - main jobs: decompile: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' - - name: Install latest release - run: pip install --user --upgrade pywin32 + - name: Install latest release + run: pip install --user --upgrade pywin32 - - name: Set Python user site directory - run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" + - name: Set Python user site directory + run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" - - name: Decompile shipped help file - run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + - name: Decompile shipped help file + run: hh -decompile site ${env:USER_DIR}\PyWin32.chm - - name: Rename root HTML file - run: mv site\PyWin32.HTML site\index.html + - name: Rename root HTML file + run: mv site\PyWin32.HTML site\index.html # Compress first to avoid slowly uploading thousands of individual files - - name: Create archive - run: python -m zipfile -c site.zip site + - name: Create archive + run: python -m zipfile -c site.zip site - - uses: actions/upload-artifact@v3 - with: - name: documentation - path: site.zip + - uses: actions/upload-artifact@v3 + with: + name: documentation + path: site.zip publish: runs-on: ubuntu-latest needs: - - decompile + - decompile # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 - with: - name: documentation + - uses: actions/download-artifact@v3 + with: + name: documentation - - name: Unpack archive - run: python -m zipfile -e site.zip . + - name: Unpack archive + run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: site - commit_message: ${{ github.event.head_commit.message }} + - uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site + commit_message: ${{ github.event.head_commit.message }} # Write .nojekyll at the root, see: # https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators - enable_jekyll: false + enable_jekyll: false # Only deploy if there were changes - allow_empty_commit: false + allow_empty_commit: false diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65a8120b1..b4d394101 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ on: push: pull_request: branches: - - main + - main concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -21,40 +21,40 @@ jobs: architecture: ['x64', 'x86'] steps: - - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} - - - name: Setup environment - run: | - python --version - pip --version - pip install --upgrade setuptools wheel - - - name: Build and install - run: | - python setup.py --skip-verstamp install --user - - - name: Run tests - # Run the tests directly from the source dir so support files (eg, .wav files etc) - # can be found - they aren't installed into the Python tree. - run: python pywin32_testall.py -v -skip-adodbapi - - - name: Build wheels - run: | - python setup.py bdist_wheel --skip-build - - - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: artifacts - path: | - dist/*.whl - dist/*.exe + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + + - name: Setup environment + run: | + python --version + pip --version + pip install --upgrade setuptools wheel + + - name: Build and install + run: | + python setup.py --skip-verstamp install --user + + - name: Run tests + # Run the tests directly from the source dir so support files (eg, .wav files etc) + # can be found - they aren't installed into the Python tree. + run: python pywin32_testall.py -v -skip-adodbapi + + - name: Build wheels + run: | + python setup.py bdist_wheel --skip-build + + - uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: artifacts + path: | + dist/*.whl + dist/*.exe # We cannot build and test on ARM64, so we cross-compile. # Later, when available, we can add tests using this wheel on ARM64 VMs @@ -67,35 +67,35 @@ jobs: python-version: ['3.10', '3.11', '3.12-dev'] steps: - - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: 'x64' - - - name: Setup Environment - run: | - python --version - pip --version - pip install --upgrade setuptools wheel - - - name: Obtain ARM64 library files - run: | - python .github\workflows\download-arm64-libs.py .\arm64libs - - - name: Build wheels - run: python setup.py --skip-verstamp build_ext -L .\arm64libs --plat-name win-arm64 build --plat-name win-arm64 bdist_wheel --plat-name win-arm64 - - - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: artifacts - path: | - dist/*.whl - - # This job can be run locally with the `format_all.bat` script + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: 'x64' + + - name: Setup Environment + run: | + python --version + pip --version + pip install --upgrade setuptools wheel + + - name: Obtain ARM64 library files + run: | + python .github\workflows\download-arm64-libs.py .\arm64libs + + - name: Build wheels + run: python setup.py --skip-verstamp build_ext -L .\arm64libs --plat-name win-arm64 build --plat-name win-arm64 bdist_wheel --plat-name win-arm64 + + - uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: artifacts + path: |- + dist/*.whl + + # This job can be run locally by running `pre-commit run` checkers: runs-on: ubuntu-latest steps: diff --git a/.isort.cfg b/.isort.cfg index b0ab5c40e..706a5ecaf 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,5 +1,5 @@ [isort] -py_version=37 +py_version = 37 profile = black combine_as_imports = true skip = setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..31a06bd82 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,41 @@ +# You can run this locally with `pre-commit run [--all-files]` +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + # TODO: Activate and run in a different PR. Lots of files affected + # - id: trailing-whitespace + # args: [--markdown-linebreak-ext=md] + # - id: end-of-file-fixer + - id: mixed-line-ending + args: [--fix=crlf] + - id: check-case-conflict + - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.12.0 + hooks: + - id: pretty-format-toml + args: [--autofix, --trailing-commas] + - id: pretty-format-yaml + args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes] + - id: pretty-format-ini + args: [--autofix] + - repo: https://github.com/hadialqattan/pycln + rev: v2.4.0 + hooks: + - id: pycln + args: [--config=pycln.toml] + verbose: true + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) + verbose: true + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.2.0 + hooks: + - id: black + verbose: true + +ci: + autoupdate_schedule: quarterly diff --git a/com/win32comext/mapi/src/mapi_headers/MAPIOID.h b/com/win32comext/mapi/src/mapi_headers/MAPIOID.h index fbfcaa1e0..7029813e8 100644 --- a/com/win32comext/mapi/src/mapi_headers/MAPIOID.h +++ b/com/win32comext/mapi/src/mapi_headers/MAPIOID.h @@ -1,106 +1,107 @@ -/* - * M A P I O I D . H - * - * MAPI OID definition header file - * - * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. - */ - -#ifndef _MAPIOID_ -#define _MAPIOID_ - -/* - * MAPI 1.0 Object Identifiers (OID's) - * - * All MAPI 1.0 OIDs are prefixed by the segment - * - * {iso(1) ansi(2) usa(840) microsoft(113556) mapi(3)} - * - * All MAPI 1.0 tags are also include the addistion segment - * - * {tags(10)} - * - * All MAPI 1.0 encodings are also include the addistion segment - * - * {encodeings(11)} - * - * The set of defined tags are as follows - * - * {{mapiprefix} {tags} {tnef(1)}} MAPI 1.0 TNEF encapsulation tag - * - * {{mapiprefix} {tags} {ole(3)}} MAPI 1.0 OLE prefix - * {{mapiprefix} {tags} {ole(3)} {v1(1)}} MAPI 1.0 OLE 1.0 prefix - * {{mapiprefix} {tags} {ole(3)} {v1(1)} {storage(1)}} MAPI 1.0 OLE 1.0 OLESTREAM - * {{mapiprefix} {tags} {ole(3)} {v2(2)}} MAPI 1.0 OLE 2.0 prefix - * {{mapiprefix} {tags} {ole(3)} {v2(2)} {storage(1)}} MAPI 1.0 OLE 2.0 IStorage - * - * The set of defined encodings are as follows - * - * {{mapiprefix} {encodings} {MacBinary(1)}} MAPI 1.0 MacBinary - */ - -#define OID_TAG 0x0A -#define OID_ENCODING 0x0B - -#define DEFINE_OID_1(name, b0, b1) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_2(name, b0, b1, b2) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_3(name, b0, b1, b2, b3) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ - EXTERN_C const BYTE name[] - -#define CB_OID_1 9 -#define CB_OID_2 10 -#define CB_OID_3 11 -#define CB_OID_4 12 - -#ifdef INITOID -#include -#endif - -#ifdef USES_OID_TNEF -DEFINE_OID_1(OID_TNEF, OID_TAG, 0x01); -#define CB_OID_TNEF CB_OID_1 -#endif - -#ifdef USES_OID_OLE -DEFINE_OID_1(OID_OLE, OID_TAG, 0x03); -#define CB_OID_OLE CB_OID_1 -#endif - -#ifdef USES_OID_OLE1 -DEFINE_OID_2(OID_OLE1, OID_TAG, 0x03, 0x01); -#define CB_OID_OLE1 CB_OID_2 -#endif - -#ifdef USES_OID_OLE1_STORAGE -DEFINE_OID_3(OID_OLE1_STORAGE, OID_TAG, 0x03, 0x01, 0x01); -#define CB_OID_OLE1_STORAGE CB_OID_3 -#endif - -#ifdef USES_OID_OLE2 -DEFINE_OID_2(OID_OLE2, OID_TAG, 0x03, 0x02); -#define CB_OID_OLE2 CB_OID_2 -#endif - -#ifdef USES_OID_OLE2_STORAGE -DEFINE_OID_3(OID_OLE2_STORAGE, OID_TAG, 0x03, 0x02, 0x01); -#define CB_OID_OLE2_STORAGE CB_OID_3 -#endif - -#ifdef USES_OID_MAC_BINARY -DEFINE_OID_1(OID_MAC_BINARY, OID_ENCODING, 0x01); -#define CB_OID_MAC_BINARY CB_OID_1 -#endif - -#ifdef USES_OID_MIMETAG -DEFINE_OID_1(OID_MIMETAG, OID_TAG, 0x04); -#define CB_OID_MIMETAG CB_OID_1 -#endif - -#endif +/* + * M A P I O I D . H + * + * MAPI OID definition header file + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + + */ + +#ifndef _MAPIOID_ +#define _MAPIOID_ + +/* + * MAPI 1.0 Object Identifiers (OID's) + * + * All MAPI 1.0 OIDs are prefixed by the segment + * + * {iso(1) ansi(2) usa(840) microsoft(113556) mapi(3)} + * + * All MAPI 1.0 tags are also include the addistion segment + * + * {tags(10)} + * + * All MAPI 1.0 encodings are also include the addistion segment + * + * {encodeings(11)} + * + * The set of defined tags are as follows + * + * {{mapiprefix} {tags} {tnef(1)}} MAPI 1.0 TNEF encapsulation tag + * + * {{mapiprefix} {tags} {ole(3)}} MAPI 1.0 OLE prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)}} MAPI 1.0 OLE 1.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)} {storage(1)}} MAPI 1.0 OLE 1.0 OLESTREAM + * {{mapiprefix} {tags} {ole(3)} {v2(2)}} MAPI 1.0 OLE 2.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v2(2)} {storage(1)}} MAPI 1.0 OLE 2.0 IStorage + * + * The set of defined encodings are as follows + * + * {{mapiprefix} {encodings} {MacBinary(1)}} MAPI 1.0 MacBinary + */ + +#define OID_TAG 0x0A +#define OID_ENCODING 0x0B + +#define DEFINE_OID_1(name, b0, b1) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_2(name, b0, b1, b2) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_3(name, b0, b1, b2, b3) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ + EXTERN_C const BYTE name[] + +#define CB_OID_1 9 +#define CB_OID_2 10 +#define CB_OID_3 11 +#define CB_OID_4 12 + +#ifdef INITOID +#include +#endif + +#ifdef USES_OID_TNEF +DEFINE_OID_1(OID_TNEF, OID_TAG, 0x01); +#define CB_OID_TNEF CB_OID_1 +#endif + +#ifdef USES_OID_OLE +DEFINE_OID_1(OID_OLE, OID_TAG, 0x03); +#define CB_OID_OLE CB_OID_1 +#endif + +#ifdef USES_OID_OLE1 +DEFINE_OID_2(OID_OLE1, OID_TAG, 0x03, 0x01); +#define CB_OID_OLE1 CB_OID_2 +#endif + +#ifdef USES_OID_OLE1_STORAGE +DEFINE_OID_3(OID_OLE1_STORAGE, OID_TAG, 0x03, 0x01, 0x01); +#define CB_OID_OLE1_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_OLE2 +DEFINE_OID_2(OID_OLE2, OID_TAG, 0x03, 0x02); +#define CB_OID_OLE2 CB_OID_2 +#endif + +#ifdef USES_OID_OLE2_STORAGE +DEFINE_OID_3(OID_OLE2_STORAGE, OID_TAG, 0x03, 0x02, 0x01); +#define CB_OID_OLE2_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_MAC_BINARY +DEFINE_OID_1(OID_MAC_BINARY, OID_ENCODING, 0x01); +#define CB_OID_MAC_BINARY CB_OID_1 +#endif + +#ifdef USES_OID_MIMETAG +DEFINE_OID_1(OID_MIMETAG, OID_TAG, 0x04); +#define CB_OID_MIMETAG CB_OID_1 +#endif + +#endif diff --git a/format_all.bat b/format_all.bat deleted file mode 100644 index 10b8aeddb..000000000 --- a/format_all.bat +++ /dev/null @@ -1,3 +0,0 @@ -pycln . --config=pycln.toml -isort . -black . diff --git a/win32/Demos/service/install/perf_install.ini b/win32/Demos/service/install/perf_install.ini index ac1675045..59c8b59ad 100644 --- a/win32/Demos/service/install/perf_install.ini +++ b/win32/Demos/service/install/perf_install.ini @@ -1,18 +1,18 @@ [info] -drivername=PipeServicePerf -symbolfile=perf_install.h +drivername = PipeServicePerf +symbolfile = perf_install.h [languages] -009=English +009 = English [text] -SERVICE_009_NAME=Python Demo Service -SERVICE_009_HELP=Shows performance statistics for the sample Python service -HEARTBEAT_009_NAME=Heartbeat pulse -HEARTBEAT_009_HELP=Regular counter to indicate the service is alive. Useful so system monitors can detect health even under low loads. -READ_009_NAME=Bytes read/sec -READ_009_HELP=Number of bytes read in total -WRITE_009_NAME=Bytes written/sec -WRITE_009_HELP=Number of bytes written in total -THREADS_009_NAME=Number of threads -THREADS_009_HELP=Number of threads currently servicing client connections +SERVICE_009_NAME = Python Demo Service +SERVICE_009_HELP = Shows performance statistics for the sample Python service +HEARTBEAT_009_NAME = Heartbeat pulse +HEARTBEAT_009_HELP = Regular counter to indicate the service is alive. Useful so system monitors can detect health even under low loads. +READ_009_NAME = Bytes read/sec +READ_009_HELP = Number of bytes read in total +WRITE_009_NAME = Bytes written/sec +WRITE_009_HELP = Number of bytes written in total +THREADS_009_NAME = Number of threads +THREADS_009_HELP = Number of threads currently servicing client connections From 437ac48735b1024b1a758d1b1d871aaf7c789229 Mon Sep 17 00:00:00 2001 From: Avasam Date: Thu, 14 Mar 2024 11:53:09 -0400 Subject: [PATCH 2/2] Exclude vendored com/win32comext/mapi/src/mapi_headers/MAPIOID.h from mixed-line-ending --- .github/workflows/main.yml | 1 - .pre-commit-config.yaml | 4 +- .../mapi/src/mapi_headers/MAPIOID.h | 213 +++++++++--------- 3 files changed, 109 insertions(+), 109 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e488e520..f861a1e9a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,4 +143,3 @@ jobs: with: python-version: ${{ matrix.python-version }} annotate: errors - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31a06bd82..09831791e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# You can run this locally with `pre-commit run [--all-files]` +# You can run this locally with `pre-commit run [--all]` repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 @@ -9,6 +9,8 @@ repos: # - id: end-of-file-fixer - id: mixed-line-ending args: [--fix=crlf] + # Vendored + exclude: ^com/win32comext/mapi/src/mapi_headers/.*$ - id: check-case-conflict - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks rev: v2.12.0 diff --git a/com/win32comext/mapi/src/mapi_headers/MAPIOID.h b/com/win32comext/mapi/src/mapi_headers/MAPIOID.h index 7029813e8..fbfcaa1e0 100644 --- a/com/win32comext/mapi/src/mapi_headers/MAPIOID.h +++ b/com/win32comext/mapi/src/mapi_headers/MAPIOID.h @@ -1,107 +1,106 @@ -/* - * M A P I O I D . H - * - * MAPI OID definition header file - * - * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. - - */ - -#ifndef _MAPIOID_ -#define _MAPIOID_ - -/* - * MAPI 1.0 Object Identifiers (OID's) - * - * All MAPI 1.0 OIDs are prefixed by the segment - * - * {iso(1) ansi(2) usa(840) microsoft(113556) mapi(3)} - * - * All MAPI 1.0 tags are also include the addistion segment - * - * {tags(10)} - * - * All MAPI 1.0 encodings are also include the addistion segment - * - * {encodeings(11)} - * - * The set of defined tags are as follows - * - * {{mapiprefix} {tags} {tnef(1)}} MAPI 1.0 TNEF encapsulation tag - * - * {{mapiprefix} {tags} {ole(3)}} MAPI 1.0 OLE prefix - * {{mapiprefix} {tags} {ole(3)} {v1(1)}} MAPI 1.0 OLE 1.0 prefix - * {{mapiprefix} {tags} {ole(3)} {v1(1)} {storage(1)}} MAPI 1.0 OLE 1.0 OLESTREAM - * {{mapiprefix} {tags} {ole(3)} {v2(2)}} MAPI 1.0 OLE 2.0 prefix - * {{mapiprefix} {tags} {ole(3)} {v2(2)} {storage(1)}} MAPI 1.0 OLE 2.0 IStorage - * - * The set of defined encodings are as follows - * - * {{mapiprefix} {encodings} {MacBinary(1)}} MAPI 1.0 MacBinary - */ - -#define OID_TAG 0x0A -#define OID_ENCODING 0x0B - -#define DEFINE_OID_1(name, b0, b1) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_2(name, b0, b1, b2) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_3(name, b0, b1, b2, b3) \ - EXTERN_C const BYTE name[] - -#define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ - EXTERN_C const BYTE name[] - -#define CB_OID_1 9 -#define CB_OID_2 10 -#define CB_OID_3 11 -#define CB_OID_4 12 - -#ifdef INITOID -#include -#endif - -#ifdef USES_OID_TNEF -DEFINE_OID_1(OID_TNEF, OID_TAG, 0x01); -#define CB_OID_TNEF CB_OID_1 -#endif - -#ifdef USES_OID_OLE -DEFINE_OID_1(OID_OLE, OID_TAG, 0x03); -#define CB_OID_OLE CB_OID_1 -#endif - -#ifdef USES_OID_OLE1 -DEFINE_OID_2(OID_OLE1, OID_TAG, 0x03, 0x01); -#define CB_OID_OLE1 CB_OID_2 -#endif - -#ifdef USES_OID_OLE1_STORAGE -DEFINE_OID_3(OID_OLE1_STORAGE, OID_TAG, 0x03, 0x01, 0x01); -#define CB_OID_OLE1_STORAGE CB_OID_3 -#endif - -#ifdef USES_OID_OLE2 -DEFINE_OID_2(OID_OLE2, OID_TAG, 0x03, 0x02); -#define CB_OID_OLE2 CB_OID_2 -#endif - -#ifdef USES_OID_OLE2_STORAGE -DEFINE_OID_3(OID_OLE2_STORAGE, OID_TAG, 0x03, 0x02, 0x01); -#define CB_OID_OLE2_STORAGE CB_OID_3 -#endif - -#ifdef USES_OID_MAC_BINARY -DEFINE_OID_1(OID_MAC_BINARY, OID_ENCODING, 0x01); -#define CB_OID_MAC_BINARY CB_OID_1 -#endif - -#ifdef USES_OID_MIMETAG -DEFINE_OID_1(OID_MIMETAG, OID_TAG, 0x04); -#define CB_OID_MIMETAG CB_OID_1 -#endif - -#endif +/* + * M A P I O I D . H + * + * MAPI OID definition header file + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MAPIOID_ +#define _MAPIOID_ + +/* + * MAPI 1.0 Object Identifiers (OID's) + * + * All MAPI 1.0 OIDs are prefixed by the segment + * + * {iso(1) ansi(2) usa(840) microsoft(113556) mapi(3)} + * + * All MAPI 1.0 tags are also include the addistion segment + * + * {tags(10)} + * + * All MAPI 1.0 encodings are also include the addistion segment + * + * {encodeings(11)} + * + * The set of defined tags are as follows + * + * {{mapiprefix} {tags} {tnef(1)}} MAPI 1.0 TNEF encapsulation tag + * + * {{mapiprefix} {tags} {ole(3)}} MAPI 1.0 OLE prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)}} MAPI 1.0 OLE 1.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)} {storage(1)}} MAPI 1.0 OLE 1.0 OLESTREAM + * {{mapiprefix} {tags} {ole(3)} {v2(2)}} MAPI 1.0 OLE 2.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v2(2)} {storage(1)}} MAPI 1.0 OLE 2.0 IStorage + * + * The set of defined encodings are as follows + * + * {{mapiprefix} {encodings} {MacBinary(1)}} MAPI 1.0 MacBinary + */ + +#define OID_TAG 0x0A +#define OID_ENCODING 0x0B + +#define DEFINE_OID_1(name, b0, b1) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_2(name, b0, b1, b2) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_3(name, b0, b1, b2, b3) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ + EXTERN_C const BYTE name[] + +#define CB_OID_1 9 +#define CB_OID_2 10 +#define CB_OID_3 11 +#define CB_OID_4 12 + +#ifdef INITOID +#include +#endif + +#ifdef USES_OID_TNEF +DEFINE_OID_1(OID_TNEF, OID_TAG, 0x01); +#define CB_OID_TNEF CB_OID_1 +#endif + +#ifdef USES_OID_OLE +DEFINE_OID_1(OID_OLE, OID_TAG, 0x03); +#define CB_OID_OLE CB_OID_1 +#endif + +#ifdef USES_OID_OLE1 +DEFINE_OID_2(OID_OLE1, OID_TAG, 0x03, 0x01); +#define CB_OID_OLE1 CB_OID_2 +#endif + +#ifdef USES_OID_OLE1_STORAGE +DEFINE_OID_3(OID_OLE1_STORAGE, OID_TAG, 0x03, 0x01, 0x01); +#define CB_OID_OLE1_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_OLE2 +DEFINE_OID_2(OID_OLE2, OID_TAG, 0x03, 0x02); +#define CB_OID_OLE2 CB_OID_2 +#endif + +#ifdef USES_OID_OLE2_STORAGE +DEFINE_OID_3(OID_OLE2_STORAGE, OID_TAG, 0x03, 0x02, 0x01); +#define CB_OID_OLE2_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_MAC_BINARY +DEFINE_OID_1(OID_MAC_BINARY, OID_ENCODING, 0x01); +#define CB_OID_MAC_BINARY CB_OID_1 +#endif + +#ifdef USES_OID_MIMETAG +DEFINE_OID_1(OID_MIMETAG, OID_TAG, 0x04); +#define CB_OID_MIMETAG CB_OID_1 +#endif + +#endif