Convert code to use libcdio, create a basic UNIX makefile, remove all Windows DDK/SDK dependencies, unneeded headers, and created a TODO file.
This commit is contained in:
0
FloatUtils.cpp
Executable file → Normal file
0
FloatUtils.cpp
Executable file → Normal file
0
FloatUtils.h
Executable file → Normal file
0
FloatUtils.h
Executable file → Normal file
129
Makefile
129
Makefile
@@ -1,118 +1,21 @@
|
|||||||
### Generated by Winemaker 0.8.4
|
OBJS = FloatUtils.o cdtoimg.o
|
||||||
###
|
CC = g++
|
||||||
### Invocation command line was
|
DEBUG = -g
|
||||||
### /opt/local/bin/winemaker cdtoimg.sln
|
CFLAGS = -Wall -O0 -W -c $(DEBUG)
|
||||||
|
LFLAGS = -Wall $(DEBUG)
|
||||||
|
LIBS = -lm -lcdio
|
||||||
|
|
||||||
|
cdtoimg : $(OBJS)
|
||||||
|
$(CC) $(LFLAGS) $(LIBS) $(OBJS) -o cdtoimg
|
||||||
|
|
||||||
SRCDIR = .
|
FloatUtils.o : FloatUtils.h FloatUtils.cpp
|
||||||
SUBDIRS =
|
$(CC) $(CFLAGS) FloatUtils.cpp
|
||||||
DLLS =
|
|
||||||
LIBS =
|
|
||||||
EXES = cdtoimg.exe
|
|
||||||
|
|
||||||
|
cdtoimg.o : cdtoimg.cpp FloatUtils.h
|
||||||
|
$(CC) $(CFLAGS) cdtoimg.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
\rm *.o cdtoimg
|
||||||
|
|
||||||
### Common settings
|
tar: $(OBJS)
|
||||||
|
tar jcfv cdtoimg.tbz FloatUtils.h FloatUtils.cpp readme.txt Makefile cdtoimg
|
||||||
CEXTRA = -O0 -W \
|
|
||||||
-mno-cygwin
|
|
||||||
CXXEXTRA = -O0 -W
|
|
||||||
RCEXTRA =
|
|
||||||
DEFINES = -DWIN32 -D_DEBUG -D_CONSOLE
|
|
||||||
INCLUDE_PATH =
|
|
||||||
DLL_PATH =
|
|
||||||
DLL_IMPORTS =
|
|
||||||
LIBRARY_PATH =
|
|
||||||
LIBRARIES =
|
|
||||||
|
|
||||||
|
|
||||||
### cdtoimg.exe sources and settings
|
|
||||||
|
|
||||||
cdtoimg_exe_MODULE = cdtoimg.exe
|
|
||||||
cdtoimg_exe_C_SRCS =
|
|
||||||
cdtoimg_exe_CXX_SRCS = FloatUtils.cpp \
|
|
||||||
cdtoimg.cpp
|
|
||||||
cdtoimg_exe_RC_SRCS =
|
|
||||||
cdtoimg_exe_LDFLAGS = -mwindows \
|
|
||||||
-mno-cygwin
|
|
||||||
cdtoimg_exe_ARFLAGS =
|
|
||||||
cdtoimg_exe_DLL_PATH =
|
|
||||||
cdtoimg_exe_DLLS = odbc32 \
|
|
||||||
ole32 \
|
|
||||||
oleaut32 \
|
|
||||||
winspool \
|
|
||||||
odbccp32
|
|
||||||
cdtoimg_exe_LIBRARY_PATH=
|
|
||||||
cdtoimg_exe_LIBRARIES = uuid
|
|
||||||
|
|
||||||
cdtoimg_exe_OBJS = $(cdtoimg_exe_C_SRCS:.c=.o) \
|
|
||||||
$(cdtoimg_exe_CXX_SRCS:.cpp=.o) \
|
|
||||||
$(cdtoimg_exe_RC_SRCS:.rc=.res)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Global source lists
|
|
||||||
|
|
||||||
C_SRCS = $(cdtoimg_exe_C_SRCS)
|
|
||||||
CXX_SRCS = $(cdtoimg_exe_CXX_SRCS)
|
|
||||||
RC_SRCS = $(cdtoimg_exe_RC_SRCS)
|
|
||||||
|
|
||||||
|
|
||||||
### Tools
|
|
||||||
|
|
||||||
CC = winegcc
|
|
||||||
CXX = wineg++
|
|
||||||
RC = wrc
|
|
||||||
AR = ar
|
|
||||||
|
|
||||||
|
|
||||||
### Generic targets
|
|
||||||
|
|
||||||
all: $(SUBDIRS) $(DLLS:%=%.so) $(LIBS) $(EXES)
|
|
||||||
|
|
||||||
### Build rules
|
|
||||||
|
|
||||||
.PHONY: all clean dummy
|
|
||||||
|
|
||||||
$(SUBDIRS): dummy
|
|
||||||
@cd $@ && $(MAKE)
|
|
||||||
|
|
||||||
# Implicit rules
|
|
||||||
|
|
||||||
.SUFFIXES: .cpp .cxx .rc .res
|
|
||||||
DEFINCL = $(INCLUDE_PATH) $(DEFINES) $(OPTIONS)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) -c $(CFLAGS) $(CEXTRA) $(DEFINCL) -o $@ $<
|
|
||||||
|
|
||||||
.cpp.o:
|
|
||||||
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<
|
|
||||||
|
|
||||||
.cxx.o:
|
|
||||||
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<
|
|
||||||
|
|
||||||
.rc.res:
|
|
||||||
$(RC) $(RCFLAGS) $(RCEXTRA) $(DEFINCL) -fo$@ $<
|
|
||||||
|
|
||||||
# Rules for cleaning
|
|
||||||
|
|
||||||
CLEAN_FILES = y.tab.c y.tab.h lex.yy.c core *.orig *.rej \
|
|
||||||
\\\#*\\\# *~ *% .\\\#*
|
|
||||||
|
|
||||||
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
|
|
||||||
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o)
|
|
||||||
$(RM) $(DLLS:%=%.so) $(LIBS) $(EXES) $(EXES:%=%.so)
|
|
||||||
|
|
||||||
$(SUBDIRS:%=%/__clean__): dummy
|
|
||||||
cd `dirname $@` && $(MAKE) clean
|
|
||||||
|
|
||||||
$(EXTRASUBDIRS:%=%/__clean__): dummy
|
|
||||||
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
|
|
||||||
|
|
||||||
### Target specific build rules
|
|
||||||
DEFLIB = $(LIBRARY_PATH) $(LIBRARIES) $(DLL_PATH) $(DLL_IMPORTS:%=-l%)
|
|
||||||
|
|
||||||
$(cdtoimg_exe_MODULE): $(cdtoimg_exe_OBJS)
|
|
||||||
$(CXX) $(cdtoimg_exe_LDFLAGS) -o $@ $(cdtoimg_exe_OBJS) $(cdtoimg_exe_LIBRARY_PATH) $(cdtoimg_exe_DLL_PATH) $(DEFLIB) $(cdtoimg_exe_DLLS:%=-l%) $(cdtoimg_exe_LIBRARIES:%=-l%)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
TODO
Normal file
6
TODO
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Move source files to src folder.
|
||||||
|
Output binaries to obj folder.
|
||||||
|
Create autoconf, to check libcdio is present on system.
|
||||||
|
Check with MinGW.
|
||||||
|
Check if compilable with VisualC++.
|
||||||
|
Make it use D8 command.
|
||||||
1614
cdtoimg.cpp
Executable file → Normal file
1614
cdtoimg.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
BIN
cdtoimg.ncb
BIN
cdtoimg.ncb
Binary file not shown.
21
cdtoimg.sln
21
cdtoimg.sln
@@ -1,21 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdtoimg", "cdtoimg.vcproj", "{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
|
||||||
ConfigName.0 = Debug
|
|
||||||
ConfigName.1 = Release
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectDependencies) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
|
||||||
{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}.Debug.ActiveCfg = Release|Win32
|
|
||||||
{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}.Debug.Build.0 = Release|Win32
|
|
||||||
{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}.Release.ActiveCfg = Release|Win32
|
|
||||||
{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}.Release.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
BIN
cdtoimg.suo
BIN
cdtoimg.suo
Binary file not shown.
135
cdtoimg.vcproj
135
cdtoimg.vcproj
@@ -1,135 +0,0 @@
|
|||||||
<?xml version="1.0" encoding = "Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="7.00"
|
|
||||||
Name="cdtoimg"
|
|
||||||
ProjectGUID="{2C7E8552-DC0B-42AC-BE6F-84F6237FE52E}"
|
|
||||||
Keyword="Win32Proj">
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"/>
|
|
||||||
</Platforms>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="Debug"
|
|
||||||
IntermediateDirectory="Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="2">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="TRUE"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="5"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
|
||||||
DebugInformationFormat="4"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/cdtoimg.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
ProgramDatabaseFile="$(OutDir)/cdtoimg.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="Release"
|
|
||||||
IntermediateDirectory="Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="2">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
OmitFramePointers="TRUE"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="TRUE"
|
|
||||||
RuntimeLibrary="4"
|
|
||||||
EnableFunctionLevelLinking="TRUE"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
|
||||||
DebugInformationFormat="3"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/cdtoimg.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<Files>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
|
||||||
<File
|
|
||||||
RelativePath="FloatUtils.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="cdtoimg.cpp">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc">
|
|
||||||
<File
|
|
||||||
RelativePath="FloatUtils.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="my_ntddscsi.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="sam.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="spc.h">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Resource Files"
|
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#ifndef MY_NTDDSCSI_H
|
|
||||||
#define MY_NTDDSCSI_H
|
|
||||||
|
|
||||||
#include "spc.h"
|
|
||||||
|
|
||||||
//** Defines taken from ntddscsi.h in MS Windows DDK CD
|
|
||||||
#define SCSI_IOCTL_DATA_OUT 0 //Give data to SCSI device (e.g. for writing)
|
|
||||||
#define SCSI_IOCTL_DATA_IN 1 //Get data from SCSI device (e.g. for reading)
|
|
||||||
#define SCSI_IOCTL_DATA_UNSPECIFIED 2 //No data (e.g. for ejecting)
|
|
||||||
|
|
||||||
#define IOCTL_SCSI_PASS_THROUGH 0x4D004
|
|
||||||
typedef struct _SCSI_PASS_THROUGH {
|
|
||||||
USHORT Length;
|
|
||||||
UCHAR ScsiStatus;
|
|
||||||
UCHAR PathId;
|
|
||||||
UCHAR TargetId;
|
|
||||||
UCHAR Lun;
|
|
||||||
UCHAR CdbLength;
|
|
||||||
UCHAR SenseInfoLength;
|
|
||||||
UCHAR DataIn;
|
|
||||||
ULONG DataTransferLength;
|
|
||||||
ULONG TimeOutValue;
|
|
||||||
ULONG_PTR DataBufferOffset;
|
|
||||||
ULONG SenseInfoOffset;
|
|
||||||
UCHAR Cdb[16];
|
|
||||||
}SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
|
|
||||||
|
|
||||||
#define IOCTL_SCSI_PASS_THROUGH_DIRECT 0x4D014
|
|
||||||
typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
|
||||||
USHORT Length;
|
|
||||||
UCHAR ScsiStatus;
|
|
||||||
UCHAR PathId;
|
|
||||||
UCHAR TargetId;
|
|
||||||
UCHAR Lun;
|
|
||||||
UCHAR CdbLength;
|
|
||||||
UCHAR SenseInfoLength;
|
|
||||||
UCHAR DataIn;
|
|
||||||
ULONG DataTransferLength;
|
|
||||||
ULONG TimeOutValue;
|
|
||||||
PVOID DataBuffer;
|
|
||||||
ULONG SenseInfoOffset;
|
|
||||||
UCHAR Cdb[16];
|
|
||||||
}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
|
|
||||||
//** End of defines taken from ntddscsi.h from MS Windows DDK CD
|
|
||||||
|
|
||||||
typedef struct _SCSI_PASS_THROUGH_AND_BUFFERS {
|
|
||||||
SCSI_PASS_THROUGH spt;
|
|
||||||
BYTE DataBuffer[64*1024];
|
|
||||||
}T_SPT_BUFS;
|
|
||||||
|
|
||||||
typedef struct _SCSI_PASS_THROUGH_DIRECT_AND_SENSE_BUFFER {
|
|
||||||
SCSI_PASS_THROUGH_DIRECT sptd;
|
|
||||||
UCHAR SenseBuf[MAX_SENSE_LEN];
|
|
||||||
}T_SPDT_SBUF;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
22
sam.h
22
sam.h
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
SCSI-3 SCSI Architecture Model definitions (SAM), taken from SCSI-3 SAM1 draft.
|
|
||||||
Computer Programming Language: MS Visual Studio NET 2002 C/C++.
|
|
||||||
Author: Truman
|
|
||||||
Date written: 07 Aug 2005.
|
|
||||||
*/
|
|
||||||
#ifndef SAM_H
|
|
||||||
#define SAM_H
|
|
||||||
|
|
||||||
//SCSI return status codes.
|
|
||||||
#define STATUS_GOOD 0x00 // Status Good
|
|
||||||
#define STATUS_CHKCOND 0x02 // Check Condition
|
|
||||||
#define STATUS_CONDMET 0x04 // Condition Met
|
|
||||||
#define STATUS_BUSY 0x08 // Busy
|
|
||||||
#define STATUS_INTERM 0x10 // Intermediate
|
|
||||||
#define STATUS_INTCDMET 0x14 // Intermediate-condition met
|
|
||||||
#define STATUS_RESCONF 0x18 // Reservation conflict
|
|
||||||
#define STATUS_COMTERM 0x22 // Command Terminated
|
|
||||||
#define STATUS_QFULL 0x28 // Queue full
|
|
||||||
#define STATUS_ACA 0x30 // ACA active
|
|
||||||
|
|
||||||
#endif
|
|
||||||
51
spc.h
51
spc.h
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
SCSI-3 Primary Control definitions (SPC). 09 Oct 2006.
|
|
||||||
Definitions taken from SCSI-3 SPC1 draft.
|
|
||||||
Computer Programming Language: MS Visual Studio NET 2002 C/C++.
|
|
||||||
Author: Truman
|
|
||||||
*/
|
|
||||||
#ifndef SPC_H
|
|
||||||
#define SPC_H
|
|
||||||
|
|
||||||
#define MAX_SENSE_LEN 18 //Sense data max length
|
|
||||||
//Sense key codes..
|
|
||||||
#define SEN_KEY_NO_SEN 0x00 //No sense key info.
|
|
||||||
#define SEN_KEY_NOT_READY 0x02 //Device not ready error.
|
|
||||||
#define SEN_KEY_ILLEGAL_REQ 0x05 //Illegal request, error/s in parameters or cmd.
|
|
||||||
|
|
||||||
//CDB for test unit ready command
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned char cmd;
|
|
||||||
unsigned char reserved1;
|
|
||||||
unsigned char reserved2;
|
|
||||||
unsigned char reserved3;
|
|
||||||
unsigned char reserved4;
|
|
||||||
unsigned char control;
|
|
||||||
}T_test_unit_ready;
|
|
||||||
|
|
||||||
//Request sense return data format
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned char response_code;
|
|
||||||
unsigned char segment_no;
|
|
||||||
unsigned char flags_sensekey;
|
|
||||||
unsigned char info0;
|
|
||||||
unsigned char info1;
|
|
||||||
unsigned char info2;
|
|
||||||
unsigned char info3;
|
|
||||||
unsigned char add_len;
|
|
||||||
unsigned char com_spec_info0;
|
|
||||||
unsigned char com_spec_info1;
|
|
||||||
unsigned char com_spec_info2;
|
|
||||||
unsigned char com_spec_info3;
|
|
||||||
unsigned char ASC;
|
|
||||||
unsigned char ASCQ;
|
|
||||||
unsigned char field_rep_ucode;
|
|
||||||
unsigned char sen_key_spec15;
|
|
||||||
unsigned char sen_key_spec16;
|
|
||||||
unsigned char sen_key_spec17;
|
|
||||||
unsigned char add_sen_bytes;
|
|
||||||
}T_sense_data;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user