Rizin
unix-like reverse engineering framework and cli tools
zip_source_file_win32_utf16.c File Reference

Go to the source code of this file.

Functions

static char * utf16_allocate_tempname (const char *name, size_t extra_chars, size_t *lengthp)
 
static HANDLE __stdcall utf16_create_file (const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file)
 
static void utf16_make_tempname (char *buf, size_t len, const char *name, zip_uint32_t i)
 
static char * utf16_strdup (const char *string)
 
ZIP_EXTERN zip_source_tzip_source_win32w (zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64_t len)
 
ZIP_EXTERN zip_source_tzip_source_win32w_create (const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error)
 

Variables

zip_win32_file_operations_t ops_utf16
 

Function Documentation

◆ utf16_allocate_tempname()

static char * utf16_allocate_tempname ( const char *  name,
size_t  extra_chars,
size_t lengthp 
)
static

Definition at line 79 of file zip_source_file_win32_utf16.c.

79  {
80  *lengthp = wcslen((const wchar_t *)name) + extra_chars;
81  return (char *)malloc(*lengthp * sizeof(wchar_t));
82 }
void * malloc(size_t size)
Definition: malloc.c:123
Definition: z80asm.h:102

References malloc().

◆ utf16_create_file()

static HANDLE __stdcall utf16_create_file ( const char *  name,
DWORD  access,
DWORD  share_mode,
PSECURITY_ATTRIBUTES  security_attributes,
DWORD  creation_disposition,
DWORD  file_attributes,
HANDLE  template_file 
)
static

Definition at line 85 of file zip_source_file_win32_utf16.c.

85  {
86 #ifdef MS_UWP
87  CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
88  extParams.dwFileAttributes = file_attributes;
89  extParams.dwFileFlags = FILE_FLAG_RANDOM_ACCESS;
90  extParams.dwSecurityQosFlags = SECURITY_ANONYMOUS;
91  extParams.dwSize = sizeof(extParams);
92  extParams.hTemplateFile = template_file;
93  extParams.lpSecurityAttributes = security_attributes;
94 
95  return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams);
96 #else
97  return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file);
98 #endif
99 }
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause access
Definition: sflib.h:64

References access.

◆ utf16_make_tempname()

static void utf16_make_tempname ( char *  buf,
size_t  len,
const char *  name,
zip_uint32_t  i 
)
static

Definition at line 103 of file zip_source_file_win32_utf16.c.

103  {
104  _snwprintf((wchar_t *)buf, len, L"%s.%08x", (const wchar_t *)name, i);
105 }
size_t len
Definition: 6502dis.c:15
lzma_index ** i
Definition: index.h:629
voidpf void * buf
Definition: ioapi.h:138
#define L
Definition: zip_err_str.c:7

References i, L, and len.

◆ utf16_strdup()

static char * utf16_strdup ( const char *  string)
static

Definition at line 109 of file zip_source_file_win32_utf16.c.

109  {
110  return (char *)_wcsdup((const wchar_t *)string);
111 }

◆ zip_source_win32w()

ZIP_EXTERN zip_source_t* zip_source_win32w ( zip_t za,
const wchar_t *  fname,
zip_uint64_t  start,
zip_int64_t  len 
)

Definition at line 58 of file zip_source_file_win32_utf16.c.

58  {
59  if (za == NULL)
60  return NULL;
61 
63 }
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
Definition: sflib.h:133
zip_error_t error
Definition: zipint.h:281
ZIP_EXTERN zip_source_t * zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error)
zip_t * za
Definition: ziptool.c:79

References zip::error, create_tags_rz::fname, len, NULL, start, za, and zip_source_win32w_create().

◆ zip_source_win32w_create()

ZIP_EXTERN zip_source_t* zip_source_win32w_create ( const wchar_t *  fname,
zip_uint64_t  start,
zip_int64_t  length,
zip_error_t error 
)

Definition at line 67 of file zip_source_file_win32_utf16.c.

67  {
68  if (fname == NULL || length < -1) {
70  return NULL;
71  }
72 
73 
75 }
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
#define ZIP_ER_INVAL
Definition: zip.h:123
void error(const char *msg)
Definition: untgz.c:593
zip_source_t * zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zip_int64_t len, const zip_stat_t *st, zip_source_file_operations_t *ops, void *ops_userdata, zip_error_t *error)
zip_source_file_operations_t _zip_source_file_win32_named_ops
zip_win32_file_operations_t ops_utf16

References _zip_source_file_win32_named_ops, error(), create_tags_rz::fname, length, NULL, ops_utf16, start, ZIP_ER_INVAL, zip_error_set(), and zip_source_file_common_new().

Referenced by windows_open(), zip_source_file_create(), and zip_source_win32w().

Variable Documentation

◆ ops_utf16

Initial value:
= {
DeleteFileW,
GetFileAttributesW,
GetFileAttributesExW,
MoveFileExW,
SetFileAttributesW,
}
static void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i)
static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file)
static char * utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp)
static char * utf16_strdup(const char *string)

Definition at line 43 of file zip_source_file_win32_utf16.c.

Referenced by zip_source_win32w_create().