ReactOS 0.4.16-dev-2491-g3dc6630
lfn.c
Go to the documentation of this file.
1/* lfn.c - Functions for handling VFAT long filenames
2
3 Copyright (C) 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
4 Copyright (C) 2008-2014 Daniel Baumann <mail@daniel-baumann.ch>
5 Copyright (C) 2015 Andreas Bombe <aeb@debian.org>
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 The complete text of the GNU General Public License
21 can be found in /usr/share/common-licenses/GPL-3 file.
22*/
23
24#include "vfatlib.h"
25
26#define NDEBUG
27#include <debug.h>
28
29#ifdef __REACTOS__
30#include <pshpack1.h>
31#endif
32
33typedef struct {
34 uint8_t id; /* sequence number for slot */
35 uint8_t name0_4[10]; /* first 5 characters in name */
36 uint8_t attr; /* attribute byte */
37 uint8_t reserved; /* always 0 */
38 uint8_t alias_checksum; /* checksum for 8.3 alias */
39 uint8_t name5_10[12]; /* 6 more characters in name */
40 uint16_t start; /* starting cluster number, 0 in long slots */
41 uint8_t name11_12[4]; /* last 2 characters in name */
42} LFN_ENT;
43
44#ifdef __REACTOS__
45#include <poppack.h>
46#endif
47
48#define LFN_ID_START 0x40
49#define LFN_ID_SLOTMASK 0x1f
50
51#define CHARS_PER_LFN 13
52
53/* These modul-global vars represent the state of the LFN parser */
54unsigned char *lfn_unicode = NULL;
55unsigned char lfn_checksum;
56int lfn_slot = -1;
58int lfn_parts = 0;
59
60static unsigned char fat_uni2esc[64] = {
61 '0', '1', '2', '3', '4', '5', '6', '7',
62 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
63 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
64 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
65 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
66 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
67 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
68 'u', 'v', 'w', 'x', 'y', 'z', '+', '-'
69};
70
71/* This defines which unicode chars are directly convertable to ISO-8859-1 */
72#define UNICODE_CONVERTABLE(cl,ch) (ch == 0 && (cl < 0x80 || cl >= 0xa0))
73
74/* for maxlen param */
75#define UNTIL_0 INT_MAX
76
77#ifdef __REACTOS__
78static void copy_lfn_part(unsigned char *dst, LFN_ENT * lfn);
79static char *cnv_unicode(const unsigned char *uni, int maxlen, int use_q);
80#endif
81
82/* Convert name part in 'lfn' from unicode to ASCII */
83#ifndef __REACTOS__
84#define CNV_THIS_PART(lfn) \
85 ({ \
86 unsigned char __part_uni[CHARS_PER_LFN*2]; \
87 copy_lfn_part( __part_uni, lfn ); \
88 cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
89 })
90#else
91static __inline char* CNV_THIS_PART(LFN_ENT * lfn)
92{
93 unsigned char __part_uni[CHARS_PER_LFN*2];
94 copy_lfn_part(__part_uni, lfn);
95 return cnv_unicode(__part_uni, CHARS_PER_LFN, 0);
96}
97#endif
98
99/* Convert name parts collected so far (from previous slots) from unicode to
100 * ASCII */
101#define CNV_PARTS_SO_FAR() \
102 (cnv_unicode( lfn_unicode+(lfn_slot*CHARS_PER_LFN*2), \
103 lfn_parts*CHARS_PER_LFN, 0 ))
104
105#define BYTES_TO_WCHAR(cl,ch) ((wchar_t)((unsigned)(cl) + ((unsigned)(ch) << 8)))
106static size_t mbslen(wchar_t x)
107{
108 wchar_t wstr[] = { x, 0 };
109 return wcstombs(NULL, wstr, 0);
110}
111
112static size_t wctombs(char *dest, wchar_t x)
113{
114 wchar_t wstr[] = { x, 0 };
115 size_t size = wcstombs(NULL, wstr, 0);
116 if (size != (size_t) - 1)
117 size = wcstombs(dest, wstr, size + 1);
118 return size;
119}
120
121/* This function converts an unicode string to a normal ASCII string, assuming
122 * ISO-8859-1 charset. Characters not in 8859-1 are converted to the same
123 * escape notation as used by the kernel, i.e. the uuencode-like ":xxx" */
124static char *cnv_unicode(const unsigned char *uni, int maxlen, int use_q)
125{
126 const unsigned char *up;
127 unsigned char *out, *cp;
128 int len, val;
129 size_t x;
130
131 for (len = 0, up = uni; (up - uni) / 2 < maxlen && (up[0] || up[1]);
132 up += 2) {
133 if ((x = mbslen(BYTES_TO_WCHAR(up[0], up[1]))) != (size_t) - 1)
134 len += x;
135 else if (UNICODE_CONVERTABLE(up[0], up[1]))
136 ++len;
137 else
138 len += 4;
139 }
140 cp = out = use_q ? qalloc(&mem_queue, len + 1) : alloc(len + 1);
141
142 for (up = uni; (up - uni) / 2 < maxlen && (up[0] || up[1]); up += 2) {
143 if ((x =
144 wctombs((char *)cp, BYTES_TO_WCHAR(up[0], up[1]))) != (size_t) - 1)
145 cp += x;
146 else if (UNICODE_CONVERTABLE(up[0], up[1]))
147 *cp++ = up[0];
148 else {
149 /* here the same escape notation is used as in the Linux kernel */
150 *cp++ = ':';
151 val = (up[1] << 8) + up[0];
152 cp[2] = fat_uni2esc[val & 0x3f];
153 val >>= 6;
154 cp[1] = fat_uni2esc[val & 0x3f];
155 val >>= 6;
156 cp[0] = fat_uni2esc[val & 0x3f];
157 cp += 3;
158 }
159 }
160 *cp = 0;
161
162 return (char *)out;
163}
164
165static void copy_lfn_part(unsigned char *dst, LFN_ENT * lfn)
166{
167 memcpy(dst, lfn->name0_4, 10);
168 memcpy(dst + 10, lfn->name5_10, 12);
169 memcpy(dst + 22, lfn->name11_12, 4);
170}
171
172static void clear_lfn_slots(int start, int end)
173{
174 int i;
176
177 /* New dir entry is zeroed except first byte, which is set to 0xe5.
178 * This is to avoid that some FAT-reading OSes (not Linux! ;) stop reading
179 * a directory at the first zero entry...
180 */
181 memset(&empty, 0, sizeof(empty));
182 empty.id = DELETED_FLAG;
183
184 for (i = start; i <= end; ++i) {
185 fs_write(lfn_offsets[i], sizeof(LFN_ENT), &empty);
186 }
187}
188
190{
191 int i;
192 uint8_t sum;
193 for (sum = 0, i = 0; i < 11; i++)
194 sum = (((sum & 1) << 7) | ((sum & 0xfe) >> 1)) + short_name[i];
195
196 for (; from < to; from += sizeof(LFN_ENT)) {
197 fs_write(from + offsetof(LFN_ENT, alias_checksum), sizeof(sum), &sum);
198 }
199}
200
201void lfn_reset(void)
202{
203 if (lfn_unicode)
206 if (lfn_offsets)
209 lfn_slot = -1;
210}
211
212/* This function is only called with de->attr == VFAT_LN_ATTR. It stores part
213 * of the long name. */
214void lfn_add_slot(DIR_ENT * de, off_t dir_offset)
215{
216 LFN_ENT *lfn = (LFN_ENT *) de;
217 int slot = lfn->id & LFN_ID_SLOTMASK;
218 unsigned offset;
219
220 if (lfn_slot == 0)
222
223 if (de->attr != VFAT_LN_ATTR)
224 die("lfn_add_slot called with non-LFN directory entry");
225
226 if (lfn->id & LFN_ID_START && slot != 0) {
227 if (lfn_slot != -1) {
228 int can_clear = 0;
229 /* There is already a LFN "in progess", so it is an error that a
230 * new start entry is here. */
231 /* Causes: 1) if slot# == expected: start bit set mysteriously, 2)
232 * old LFN overwritten by new one */
233 /* Fixes: 1) delete previous LFN 2) if slot# == expected and
234 * checksum ok: clear start bit */
235 /* XXX: Should delay that until next LFN known (then can better
236 * display the name) */
237 printf("A new long file name starts within an old one.\n");
238 if (slot == lfn_slot && lfn->alias_checksum == lfn_checksum) {
239 char *part1 = CNV_THIS_PART(lfn);
240 char *part2 = CNV_PARTS_SO_FAR();
241 printf(" It could be that the LFN start bit is wrong here\n"
242 " if \"%s\" seems to match \"%s\".\n", part1, part2);
243 free(part1);
244 free(part2);
245 can_clear = 1;
246 }
247 if (interactive) {
248 printf("1: Delete previous LFN\n2: Leave it as it is.\n");
249 if (can_clear)
250 printf("3: Clear start bit and concatenate LFNs\n");
251 } else
252 printf(" Not auto-correcting this.\n");
253 if (interactive) {
254 switch (get_key(can_clear ? "123" : "12", "?")) {
255 case '1':
257 lfn_reset();
258 break;
259 case '2':
260 break;
261 case '3':
262 lfn->id &= ~LFN_ID_START;
263 fs_write(dir_offset + offsetof(LFN_ENT, id),
264 sizeof(lfn->id), &lfn->id);
265 break;
266 }
267 }
268 }
269 lfn_slot = slot;
272 lfn_offsets = alloc(lfn_slot * sizeof(off_t));
273 lfn_parts = 0;
274 } else if (lfn_slot == -1 && slot != 0) {
275 /* No LFN in progress, but slot found; start bit missing */
276 /* Causes: 1) start bit got lost, 2) Previous slot with start bit got
277 * lost */
278 /* Fixes: 1) delete LFN, 2) set start bit */
279 char *part = CNV_THIS_PART(lfn);
280 printf("Long filename fragment \"%s\" found outside a LFN "
281 "sequence.\n (Maybe the start bit is missing on the "
282 "last fragment)\n", part);
283 free(part);
284 if (interactive) {
285 printf("1: Delete fragment\n2: Leave it as it is.\n"
286 "3: Set start bit\n");
287 } else
288 printf(" Not auto-correcting this.\n");
289 switch (interactive ? get_key("123", "?") : '2') {
290 case '1':
291 if (!lfn_offsets)
292 lfn_offsets = alloc(sizeof(off_t));
293 lfn_offsets[0] = dir_offset;
294 clear_lfn_slots(0, 0);
295 lfn_reset();
296 return;
297 case '2':
298 lfn_reset();
299 return;
300 case '3':
301 lfn->id |= LFN_ID_START;
302 fs_write(dir_offset + offsetof(LFN_ENT, id),
303 sizeof(lfn->id), &lfn->id);
304 lfn_slot = slot;
307 lfn_offsets = alloc(lfn_slot * sizeof(off_t));
308 lfn_parts = 0;
309 break;
310 }
311 } else if (slot != lfn_slot) {
312 /* wrong sequence number */
313 /* Causes: 1) seq-no destroyed */
314 /* Fixes: 1) delete LFN, 2) fix number (maybe only if following parts
315 * are ok?, maybe only if checksum is ok?) (Attention: space
316 * for name was allocated before!) */
317 int can_fix = 0;
318 printf("Unexpected long filename sequence number "
319 "(%d vs. expected %d).\n", slot, lfn_slot);
320 if (lfn->alias_checksum == lfn_checksum && lfn_slot > 0) {
321 char *part1 = CNV_THIS_PART(lfn);
322 char *part2 = CNV_PARTS_SO_FAR();
323 printf(" It could be that just the number is wrong\n"
324 " if \"%s\" seems to match \"%s\".\n", part1, part2);
325 free(part1);
326 free(part2);
327 can_fix = 1;
328 }
329 if (interactive) {
330 printf
331 ("1: Delete LFN\n2: Leave it as it is (and ignore LFN so far)\n");
332 if (can_fix)
333 printf("3: Correct sequence number\n");
334 } else
335 printf(" Not auto-correcting this.\n");
336 switch (interactive ? get_key(can_fix ? "123" : "12", "?") : '2') {
337 case '1':
338 if (!lfn_offsets) {
339 lfn_offsets = alloc(sizeof(off_t));
340 lfn_parts = 0;
341 }
342 lfn_offsets[lfn_parts++] = dir_offset;
344 lfn_reset();
345 return;
346 case '2':
347 lfn_reset();
348 return;
349 case '3':
350 lfn->id = (lfn->id & ~LFN_ID_SLOTMASK) | lfn_slot;
351 fs_write(dir_offset + offsetof(LFN_ENT, id),
352 sizeof(lfn->id), &lfn->id);
353 break;
354 }
355 }
356
357 if (lfn->alias_checksum != lfn_checksum) {
358 /* checksum mismatch */
359 /* Causes: 1) checksum field here destroyed */
360 /* Fixes: 1) delete LFN, 2) fix checksum */
361 printf("Checksum in long filename part wrong "
362 "(%02x vs. expected %02x).\n",
364 if (interactive) {
365 printf("1: Delete LFN\n2: Leave it as it is.\n"
366 "3: Correct checksum\n");
367 } else
368 printf(" Not auto-correcting this.\n");
369 if (interactive) {
370 switch (get_key("123", "?")) {
371 case '1':
372 lfn_offsets[lfn_parts++] = dir_offset;
374 lfn_reset();
375 return;
376 case '2':
377 break;
378 case '3':
380 fs_write(dir_offset + offsetof(LFN_ENT, alias_checksum),
381 sizeof(lfn->alias_checksum), &lfn->alias_checksum);
382 break;
383 }
384 }
385 }
386
387 if (lfn_slot != -1) {
388 lfn_slot--;
391 if (lfn->id & LFN_ID_START)
392 lfn_unicode[offset + 26] = lfn_unicode[offset + 27] = 0;
393 lfn_offsets[lfn_parts++] = dir_offset;
394 }
395
396 if (lfn->reserved != 0) {
397 printf("Reserved field in VFAT long filename slot is not 0 "
398 "(but 0x%02x).\n", lfn->reserved);
399 if (interactive)
400 printf("1: Fix.\n2: Leave it.\n");
401 else
402 printf("Auto-setting to 0.\n");
403 if (!interactive || get_key("12", "?") == '1') {
404 lfn->reserved = 0;
405 fs_write(dir_offset + offsetof(LFN_ENT, reserved),
406 sizeof(lfn->reserved), &lfn->reserved);
407 }
408 }
409 if (lfn->start != htole16(0)) {
410 printf("Start cluster field in VFAT long filename slot is not 0 "
411 "(but 0x%04x).\n", lfn->start);
412 if (interactive)
413 printf("1: Fix.\n2: Leave it.\n");
414 else
415 printf("Auto-setting to 0.\n");
416 if (!interactive || get_key("12", "?") == '1') {
417 lfn->start = htole16(0);
418 fs_write(dir_offset + offsetof(LFN_ENT, start),
419 sizeof(lfn->start), &lfn->start);
420 }
421 }
422}
423
424/* This function is always called when de->attr != VFAT_LN_ATTR is found, to
425 * retrieve the previously constructed LFN. */
426char *lfn_get(DIR_ENT * de, off_t * lfn_offset)
427{
428 char *lfn;
429 uint8_t sum;
430 int i;
431
432 *lfn_offset = 0;
433 if (de->attr == VFAT_LN_ATTR)
434 die("lfn_get called with LFN directory entry");
435
436#if 0
437 if (de->lcase)
438 printf("lcase=%02x\n", de->lcase);
439#endif
440
441 if (lfn_slot == -1)
442 /* no long name for this file */
443 return NULL;
444
445 if (lfn_slot != 0) {
446 /* The long name isn't finished yet. */
447 /* Causes: 1) LFN slot overwritten by non-VFAT aware tool */
448 /* Fixes: 1) delete LFN 2) move overwriting entry to somewhere else
449 * and let user enter missing part of LFN (hard to do :-()
450 * 3) renumber entries and truncate name */
451 char *long_name = CNV_PARTS_SO_FAR();
452 char *short_name = file_name(de->name);
453 printf("Unfinished long file name \"%s\".\n"
454 " (Start may have been overwritten by %s)\n",
457 if (interactive) {
458 printf("1: Delete LFN\n2: Leave it as it is.\n"
459 "3: Fix numbering (truncates long name and attaches "
460 "it to short name %s)\n", short_name);
461 } else
462 printf(" Not auto-correcting this.\n");
463 switch (interactive ? get_key("123", "?") : '2') {
464 case '1':
466 lfn_reset();
467 return NULL;
468 case '2':
469 lfn_reset();
470 return NULL;
471 case '3':
472 for (i = 0; i < lfn_parts; ++i) {
473 uint8_t id = (lfn_parts - i) | (i == 0 ? LFN_ID_START : 0);
475 sizeof(id), &id);
476 }
479 break;
480 }
481 }
482
483 for (sum = 0, i = 0; i < MSDOS_NAME; i++)
484 sum = (((sum & 1) << 7) | ((sum & 0xfe) >> 1)) + de->name[i];
485 if (sum != lfn_checksum) {
486 /* checksum doesn't match, long name doesn't apply to this alias */
487 /* Causes: 1) alias renamed */
488 /* Fixes: 1) Fix checksum in LFN entries */
489 char *long_name = CNV_PARTS_SO_FAR();
490 char *short_name = file_name(de->name);
491 printf("Wrong checksum for long file name \"%s\".\n"
492 " (Short name %s may have changed without updating the long name)\n",
495 if (interactive) {
496 printf("1: Delete LFN\n2: Leave it as it is.\n"
497 "3: Fix checksum (attaches to short name %s)\n", short_name);
498 } else
499 printf(" Not auto-correcting this.\n");
500 if (interactive) {
501 switch (get_key("123", "?")) {
502 case '1':
504 lfn_reset();
505 return NULL;
506 case '2':
507 lfn_reset();
508 return NULL;
509 case '3':
510 for (i = 0; i < lfn_parts; ++i) {
511 fs_write(lfn_offsets[i] + offsetof(LFN_ENT, alias_checksum),
512 sizeof(sum), &sum);
513 }
514 break;
515 }
516 }
517 }
518
519 *lfn_offset = lfn_offsets[0];
521 lfn_reset();
522 return (lfn);
523}
524
526{
527 char *long_name;
528
529 if (lfn_slot == -1)
530 return;
531
533 printf("Orphaned long file name part \"%s\"\n", long_name);
535 if (interactive)
536 printf("1: Delete.\n2: Leave it.\n");
537#ifdef __REACTOS__
538 else if (rw)
539#else
540 else
541#endif
542 printf(" Auto-deleting.\n");
543#ifdef __REACTOS__
544 if ((!interactive && rw) || (interactive && get_key("12", "?") == '1')) {
545#else
546 if (!interactive || get_key("12", "?") == '1') {
547#endif
549 }
550 lfn_reset();
551}
#define __inline
Definition: _wctype.cpp:15
const WCHAR * short_name
Definition: reg.c:29
const WCHAR * long_name
Definition: reg.c:30
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
static const WCHAR empty[1]
Definition: string.c:47
unsigned int size_t
Definition: corecrt.h:203
unsigned short uint16_t
Definition: stdint.h:35
unsigned char uint8_t
Definition: stdint.h:33
r reserved
Definition: btrfs.c:3006
__kernel_off_t off_t
Definition: linux.h:201
#define printf
Definition: freeldr.h:104
#define VFAT_LN_ATTR
Definition: fsck.fat.h:78
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLenum GLenum dst
Definition: glext.h:6340
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define up(mutex)
Definition: glue.h:30
#define CNV_PARTS_SO_FAR()
Definition: lfn.c:101
#define CNV_THIS_PART(lfn)
Definition: lfn.c:84
#define UNICODE_CONVERTABLE(cl, ch)
Definition: lfn.c:72
void lfn_add_slot(DIR_ENT *de, off_t dir_offset)
Definition: lfn.c:214
static unsigned char fat_uni2esc[64]
Definition: lfn.c:60
int lfn_slot
Definition: lfn.c:56
static size_t wctombs(char *dest, wchar_t x)
Definition: lfn.c:112
int lfn_parts
Definition: lfn.c:58
#define CHARS_PER_LFN
Definition: lfn.c:51
static size_t mbslen(wchar_t x)
Definition: lfn.c:106
#define LFN_ID_SLOTMASK
Definition: lfn.c:49
off_t * lfn_offsets
Definition: lfn.c:57
unsigned char lfn_checksum
Definition: lfn.c:55
static void clear_lfn_slots(int start, int end)
Definition: lfn.c:172
void lfn_check_orphaned(void)
Definition: lfn.c:525
void lfn_fix_checksum(off_t from, off_t to, const char *short_name)
Definition: lfn.c:189
static void copy_lfn_part(unsigned char *dst, LFN_ENT *lfn)
Definition: lfn.c:165
void lfn_reset(void)
Definition: lfn.c:201
char * lfn_get(DIR_ENT *de, off_t *lfn_offset)
Definition: lfn.c:426
#define LFN_ID_START
Definition: lfn.c:48
#define BYTES_TO_WCHAR(cl, ch)
Definition: lfn.c:105
#define UNTIL_0
Definition: lfn.c:75
unsigned char * lfn_unicode
Definition: lfn.c:54
static char * cnv_unicode(const unsigned char *uni, int maxlen, int use_q)
Definition: lfn.c:124
POINT cp
Definition: magnifier.c:59
#define die(str)
Definition: mkdosfs.c:347
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static char * dest
Definition: rtl.c:135
static LPCWSTR file_name
Definition: protocol.c:147
#define DELETED_FLAG
Definition: msdos_fs.h:43
#define MSDOS_NAME
Definition: msdos_fs.h:46
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define mem_queue
Definition: rosglue.h:44
#define alloc
Definition: rosglue.h:13
#define rw
Definition: rosglue.h:38
#define interactive
Definition: rosglue.h:34
#define offsetof(TYPE, MEMBER)
wcstombs
Definition: stdlib.h:1013
void * qalloc(void **root, int size)
Definition: common.c:139
char get_key(const char *valid, const char *prompt)
Definition: common.c:184
void fs_write(off_t pos, int size, void *data)
Definition: io.c:344
#define memset(x, y, z)
Definition: compat.h:39
CardRegion * from
Definition: spigame.cpp:19
#define htole16(x)
Definition: storage32.h:546
Definition: lfn.c:33
uint8_t id
Definition: lfn.c:34
uint8_t name5_10[12]
Definition: lfn.c:39
uint8_t reserved
Definition: lfn.c:37
uint8_t attr
Definition: lfn.c:36
uint16_t start
Definition: lfn.c:40
uint8_t alias_checksum
Definition: lfn.c:38
uint8_t name11_12[4]
Definition: lfn.c:41
uint8_t name0_4[10]
Definition: lfn.c:35
Definition: vfat.h:185
struct _slot slot
Definition: vfat.h:196
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383