Skip to content

Apply changes from PR #15 for UDFS (C++ to C conversion)#304

Draft
Copilot wants to merge 6 commits into
udf-devfrom
copilot/udfs-apply-pr
Draft

Apply changes from PR #15 for UDFS (C++ to C conversion)#304
Copilot wants to merge 6 commits into
udf-devfrom
copilot/udfs-apply-pr

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 27, 2026

Converts the UDFS filesystem driver from C++ to C by applying the changes from assorted/reactos PR #15.

Changes Made

File Renames

  • Renamed all .cpp source files to .c in udfs/, udf_info/, and Include/

Build System

  • Updated CMakeLists.txt: changed .cpp to .c in SOURCE list, removed -fpermissive, -Wno-invalid-offsetof (GCC), and -Wno-extern-c-compat (Clang)

Header Fixes

  • struct.h: Added C typedef forward declarations, replaced using X = Y* with typedef Y* X, replaced static_assert with C_ASSERT, added UCHAR Placeholder to empty FCB_DATA/FCB_INDEX structs, converted enums to typedef enum
  • protos.h: Removed extern "C" from DriverEntry, added typedef enum TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE, changed 5 standalone inline functions to static inline
  • udffs.h: Changed 3 standalone inline functions to static inline
  • Include/phys_lib.h: Removed C++ default parameter values from UDFTRead/UDFTWrite
  • Include/mem_tools.h: Added #ifdef MY_USE_INTERNAL_MEMMANAGER guard around function declarations, changed inline to static inline
  • Include/Sys_spec_lib.h: Fixed (LONGLONG)Vcb(LONGLONG)(ULONG_PTR)Vcb
  • udf_info/ecma_167.h: Added struct typedefs

Source File Fixes

  • Include/string_lib.c: Removed 4 extern "C" from function definitions
  • Include/phys_lib.c: Fixed IOCTL argument order, removed unused variables, added explicit Flags=0 to UDFReadSectors/UDFWriteSectors calls
  • strucsup.c: Changed 7 inline to static inline, changed FILE_ID FileId{} to FILE_ID FileId = {0}, replaced RTL_CONSTANT_STRING assignments with RtlInitUnicodeString calls
  • misc.c: Changed false to FALSE
  • fscntrl.c: Changed auto RealDevice to PDEVICE_OBJECT RealDevice, fixed __try/__except to _SEH2_TRY/_SEH2_EXCEPT/_SEH2_END in UDFGetVolumeBitmap
  • write.c: Added explicit Flags=0 to UDFTWrite call, fixed LARGE_INTEGER initialization to {{0, 0}}
  • env_spec.c: Removed 2 unused PVCB Vcb = NULL declarations
  • verfysup.c: Added default: break case in switch statement
  • udf_info/udf_info.c: Fixed return NULLreturn STATUS_UNSUCCESSFUL in UDFReadTagged
  • udf_info/alloc.c: Fixed parameter types (PLONG_ADPSHORT_AD / PEXT_AD) in function signatures
  • sys_spec.c, mem.c, misc.c, udf_info/physical.c: Updated #include paths from .cpp to .c

Copilot AI linked an issue Apr 27, 2026 that may be closed by this pull request
- Rename all .cpp source files to .c
- Update CMakeLists.txt: .cpp -> .c, remove C++-specific warning flags
- struct.h: Add C typedef forward declarations, replace using/static_assert/enum with C equivalents, add placeholder members to empty structs
- protos.h: Remove extern "C" from DriverEntry, add typedef for TYPE_OF_ACQUIRE enum
- Include/phys_lib.h: Remove default parameter values (= 0) from UDFTRead/UDFTWrite
- Include/mem_tools.h: Wrap internal memmanager declarations in #ifdef, change inline to static inline
- Include/Sys_spec_lib.h: Add ULONG_PTR cast for pointer-to-integer conversion
- Include/string_lib.c: Remove extern "C" linkage specifiers
- Include/phys_lib.c: Fix IOCTL argument order, remove unreachable code, add explicit Flags=0 arguments
- strucsup.c: Change standalone inline to static inline
- misc.c: Change false to FALSE
- fscntrl.c: Replace auto with explicit type, use _SEH2 macros for SEH
- write.c: Add explicit Flags=0 argument to UDFTWrite, fix LARGE_INTEGER initializers
- verfysup.c: Add default case to switch statement
- env_spec.c: Remove unused PVCB Vcb = NULL variables
- udf_info/udf_info.c: Fix return type in UDFReadTagged
- udf_info/ecma_167.h: Add C typedef aliases for struct types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
@Zero3K20
Copy link
Copy Markdown
Owner

@copilot Please continue from where the rate limit was hit.

Copy link
Copy Markdown
Author

Copilot AI commented Apr 28, 2026

@copilot Please continue from where the rate limit was hit.

Continued from where we left off. The additional fixes applied in commit 990dd788 include:

  • Fixed FILE_ID FileId{};FILE_ID FileId = {0}; in strucsup.c
  • Replaced 4× LocalPath = RTL_CONSTANT_STRING(...) with RtlInitUnicodeString(&LocalPath, ...) in strucsup.c (RTL_CONSTANT_STRING can't be used in assignment context in C)
  • Changed 5 standalone inline functions → static inline in protos.h
  • Changed 3 standalone inline functions → static inline in udffs.h

All checklist items from the PR description are now complete.

Copilot AI changed the title [WIP] Apply changes from PR #15 for UDFS Apply changes from PR #15 for UDFS (C++ to C conversion) Apr 28, 2026
Copilot AI added a commit that referenced this pull request May 1, 2026
Copilot AI added a commit that referenced this pull request May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UDFS] Apply this PR

3 participants