0
0
mirror of https://github.com/libarchive/libarchive.git synced 2026-01-18 17:11:25 +01:00
Files
libarchive/tar/bsdtar_windows.h
Dustin Howett 50d44b4202 win32: shim wopen, and make both open/wopen use _s "secure" variant
The new `__la_wopen` wrapper is a copy of `__la_open` that
expects--rather than converts--a wcs parameter.

The `sopen` variants are offered as "more secure" variants of `open` and
`wopen`; I cannot vouch for their security, but some build systems are
strict about the use of "banned insecure APIs".

I've confirmed that `_wsopen_s` and `_open_s` are present in the Windows
Vista SDK.

I did not confirm that they are available in the Windows XP Platform
SDK, in part because in e61afbd463 (2016!) Tim says:

> I'd like to completely remove support for WinXP and earlier.
2025-06-26 10:56:33 -07:00

48 lines
793 B
C

/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 Michihiro NAKAJIMA
* All rights reserved.
*/
#ifndef BSDTAR_WINDOWS_H
#define BSDTAR_WINDOWS_H 1
#include <direct.h>
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <share.h>
#ifndef PRId64
#define PRId64 "I64"
#endif
#define geteuid() 0
#ifndef __WATCOMC__
#ifndef S_IFIFO
#define S_IFIFO 0010000 /* pipe */
#endif
#include <string.h> /* Must include before redefining 'strdup' */
#if !defined(__BORLANDC__)
#define strdup _strdup
#endif
#if !defined(__BORLANDC__)
#define getcwd _getcwd
#endif
#define chdir __tar_chdir
int __tar_chdir(const char *);
#ifndef S_ISREG
#define S_ISREG(a) (a & _S_IFREG)
#endif
#ifndef S_ISBLK
#define S_ISBLK(a) (0)
#endif
#endif
#endif /* !BSDTAR_WINDOWS_H */