summaryrefslogtreecommitdiff
path: root/support/dktools/dk3ufi.c
diff options
context:
space:
mode:
Diffstat (limited to 'support/dktools/dk3ufi.c')
-rw-r--r--support/dktools/dk3ufi.c419
1 files changed, 0 insertions, 419 deletions
diff --git a/support/dktools/dk3ufi.c b/support/dktools/dk3ufi.c
deleted file mode 100644
index f519efb448..0000000000
--- a/support/dktools/dk3ufi.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
-Copyright (C) 2012-2020, Dirk Krause
-SPDX-License-Identifier: BSD-3-Clause
-*/
-
-/*
- WARNING: This file was generated by the dkct program (see
- http://dktools.sourceforge.net/ for details).
- Changes you make here will be lost if dkct is run again!
- You should modify the original source and run dkct on it.
- Original source: dk3ufi.ctr
-*/
-
-/** @file dk3ufi.c The dk3ufi module.
-*/
-
-
-#line 82 "dk3ufi.ctr"
-
-#include "dk3all.h"
-#include "dk3ufi.h"
-#include "dk3unused.h"
-
-
-
-
-
-#line 90 "dk3ufi.ctr"
-
-
-
-int
-dk3ufi_get_app(dk3_ufi_t *pd, dkChar const *fn, dk3_app_t *app)
-{
-#if DK3_ON_WINDOWS
- BY_HANDLE_FILE_INFORMATION bhfi;
-#endif
- dk3_stat_t stb;
-#if DK3_ON_WINDOWS
- HANDLE hFile;
- int i;
-#endif
- int back = 0;
-
-
-#line 106 "dk3ufi.ctr"
- if((pd) && (fn)) {
- if(dk3sf_stat_app(&stb, fn, app)) {
- switch(stb.ft & (~(DK3_FT_SYMLINK))) {
- case DK3_FT_REGULAR: {
-#if DK3_ON_WINDOWS
- for(i = 0; ((i < 2) && (0 == back)); i++) {
-#if DK3_CHAR_SIZE > 2
- hFile = INVALID_HANDLE_VALUE;
-#else
-#if DK3_CHAR_SIZE > 1
-
-
-#line 117 "dk3ufi.ctr"
- hFile = CreateFileW(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
-#else
-
-
-#line 128 "dk3ufi.ctr"
- hFile = CreateFileA(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
-#endif
-#endif
- if(INVALID_HANDLE_VALUE != hFile) {
- if(GetFileInformationByHandle(hFile, &bhfi)) {
- back = 1;
-
-#line 142 "dk3ufi.ctr"
- i = 2;
- pd->volser = bhfi.dwVolumeSerialNumber;
- pd->indhigh = bhfi.nFileIndexHigh;
- pd->indlow = bhfi.nFileIndexLow;
- } else {
- /* ERROR: Failed to obtain file information! */
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
- }
- CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;
- } else {
- /* ERROR: Failed to obtain file information! */
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
- }
- }
-#else
- pd->device = stb.device;
- pd->inode = stb.inode;
- back = 1;
-#endif
- } break;
- case DK3_FT_DIRECTORY: {
-
-#line 163 "dk3ufi.ctr"
-#if DK3_ON_WINDOWS
- for(i = 0; ((i < 2) && (0 == back)); i++) {
-#if DK3_CHAR_SIZE > 2
- hFile = INVALID_HANDLE_VALUE;
-#else
-#if DK3_CHAR_SIZE > 1
-
-
-#line 170 "dk3ufi.ctr"
- hFile = CreateFileW(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- (FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_BACKUP_SEMANTICS),
- NULL
- );
-#else
-
-
-#line 181 "dk3ufi.ctr"
- hFile = CreateFileA(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- (FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_BACKUP_SEMANTICS),
- NULL
- );
-#endif
-#endif
- if(INVALID_HANDLE_VALUE != hFile) {
- if(GetFileInformationByHandle(hFile, &bhfi)) {
- back = 1;
-
-#line 195 "dk3ufi.ctr"
- i = 2;
- pd->volser = bhfi.dwVolumeSerialNumber;
- pd->indhigh = bhfi.nFileIndexHigh;
- pd->indlow = bhfi.nFileIndexLow;
- } else {
-
-#line 200 "dk3ufi.ctr"
- /* ERROR: Failed to obtain file information! */
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
- }
- CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;
- } else {
-
-#line 205 "dk3ufi.ctr"
- /* ERROR: Failed to obtain file information */
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
- }
- }
-#else
- pd->device = stb.device;
- pd->inode = stb.inode;
- back = 1;
-#endif
- } break;
- default: {
-
-#line 216 "dk3ufi.ctr"
- } break;
- }
- } else {
-
-#line 219 "dk3ufi.ctr"
- }
- } else {
-
-#line 221 "dk3ufi.ctr"
- }
-
-#line 222 "dk3ufi.ctr"
- return back;
-}
-
-
-
-int
-dk3ufi_c8_get_app(dk3_ufi_t *pd, char const *fn, dk3_app_t *app)
-{
-#if DK3_ON_WINDOWS
- BY_HANDLE_FILE_INFORMATION bhfi;
-#endif
- dk3_stat_t stb;
-#if DK3_ON_WINDOWS
- HANDLE hFile;
- int i;
-#endif
- int back = 0;
-
-
-#line 240 "dk3ufi.ctr"
- if((pd) && (fn)) {
- if(dk3sf_c8_stat_app(&stb, fn, app)) {
- switch(stb.ft & (~(DK3_FT_SYMLINK))) {
- case DK3_FT_REGULAR: {
-#if DK3_ON_WINDOWS
- for(i = 0; ((i < 2) && (0 == back)); i++) {
-
-
-#line 247 "dk3ufi.ctr"
- hFile = CreateFileA(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
- if(INVALID_HANDLE_VALUE != hFile) {
- if(GetFileInformationByHandle(hFile, &bhfi)) {
- back = 1;
-
-#line 259 "dk3ufi.ctr"
- i = 2;
- pd->volser = bhfi.dwVolumeSerialNumber;
- pd->indhigh = bhfi.nFileIndexHigh;
- pd->indlow = bhfi.nFileIndexLow;
- } else {
- /* ERROR: Failed to obtain file information! */
-#if DK3_CHAR_SIZE == 1
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
-#else
- dk3app_log_i1(app, DK3_LL_ERROR, 368);
-#endif
- }
- CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;
- } else {
- /* ERROR: Failed to obtain file information! */
-#if DK3_CHAR_SIZE == 1
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
-#else
- dk3app_log_i1(app, DK3_LL_ERROR, 368);
-#endif
- }
- }
-#else
- pd->device = stb.device;
- pd->inode = stb.inode;
- back = 1;
-#endif
- } break;
- case DK3_FT_DIRECTORY: {
-
-#line 288 "dk3ufi.ctr"
-#if DK3_ON_WINDOWS
- for(i = 0; ((i < 2) && (0 == back)); i++) {
-
-
-#line 291 "dk3ufi.ctr"
- hFile = CreateFileA(
- fn,
- ((0 == i) ? (FILE_READ_ATTRIBUTES) : 0),
- (FILE_SHARE_READ),
- NULL,
- OPEN_EXISTING,
- (FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_BACKUP_SEMANTICS),
- NULL
- );
- if(INVALID_HANDLE_VALUE != hFile) {
- if(GetFileInformationByHandle(hFile, &bhfi)) {
- back = 1;
-
-#line 303 "dk3ufi.ctr"
- i = 2;
- pd->volser = bhfi.dwVolumeSerialNumber;
- pd->indhigh = bhfi.nFileIndexHigh;
- pd->indlow = bhfi.nFileIndexLow;
- } else {
-
-#line 308 "dk3ufi.ctr"
- /* ERROR: Failed to obtain file information! */
-#if DK3_CHAR_SIZE == 1
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
-#else
- dk3app_log_i1(app, DK3_LL_ERROR, 368);
-#endif
- }
- CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;
- } else {
-
-#line 317 "dk3ufi.ctr"
- /* ERROR: Failed to obtain file information! */
-#if DK3_CHAR_SIZE == 1
- dk3app_log_i3(app, DK3_LL_ERROR, 366, 367, fn);
-#else
- dk3app_log_i1(app, DK3_LL_ERROR, 368);
-#endif
- }
- }
-#else
- pd->device = stb.device;
- pd->inode = stb.inode;
- back = 1;
-#endif
- } break;
- default: {
-
-#line 332 "dk3ufi.ctr"
- } break;
- }
- } else {
-
-#line 335 "dk3ufi.ctr"
- }
- } else {
-
-#line 337 "dk3ufi.ctr"
- }
-
-#line 338 "dk3ufi.ctr"
-
-
-#line 339 "dk3ufi.ctr"
- return back;
-}
-
-
-
-int
-dk3ufi_get(dk3_ufi_t *pd, dkChar const *fn)
-{
- int back;
- back = dk3ufi_get_app(pd, fn, NULL);
- return back;
-}
-
-
-
-int
-dk3ufi_c8_get(dk3_ufi_t *pd, char const *fn)
-{
- int back;
- back = dk3ufi_c8_get_app(pd, fn, NULL);
- return back;
-}
-
-
-
-int
-dk3ufi_compare(void const *l, void const *r, int DK3_ARG_UNUSED(cr) )
-{
- int back = 0;
- dk3_ufi_t const *pl;
- dk3_ufi_t const *pr;
-
- DK3_UNUSED_ARG(cr)
- if(l) {
- if(r) {
- pl = (dk3_ufi_t const *)l; pr = (dk3_ufi_t const *)r;
-#if DK3_ON_WINDOWS
- if(pl->volser < pr->volser) {
- back = -1;
- } else {
- if(pl->volser > pr->volser) {
- back = 1;
- }
- }
- if(0 == back) {
- if(pl->indhigh < pr->indhigh) {
- back = -1;
- } else {
- if(pl->indhigh > pr->indhigh) {
- back = 1;
- }
- }
- }
- if(0 == back) {
- if(pl->indlow < pr->indlow) {
- back = -1;
- } else {
- if(pl->indlow > pr->indlow) {
- back = 1;
- }
- }
- }
-#else
- if(pl->device < pr->device) {
- back = -1;
- } else {
- if(pl->device > pr->device) {
- back = 1;
- }
- }
- if(0 == back) {
- if(pl->inode < pr->inode) {
- back = -1;
- } else {
- if(pl->inode > pr->inode) {
- back = 1;
- }
- }
- }
-#endif
- } else back = 1;
- } else {
- if(r) back = -1;
- }
- return back;
-}
-
-