PATCH: aspi stuff
Marcus Meissner
marcus at jet.franken.de
Mon Jun 4 13:27:00 CDT 2001
On Sat, Jun 02, 2001 at 12:52:53AM -0600, Dax Kelson wrote:
> Marcus Meissner said once upon a time (Thu, 31 May 2001):
>
> > Its fine, XingDVD even uses ASPI to decrypt DVDs here ;)
> >
> > You need to add to the config file:
> >
> > [scsi c0t0d0]
> > "Device" = "/dev/sg0"
> > [scsi c0t1d0]
> > "Device" = "/dev/sg1"
> > ...
>
> Thanks!
>
> What I'm trying to do is get "FairUse" to work under Wine. It should be
> "easy", since it is one executable with two DLLs. It has no install
> routine under windows, you simply unzip to a directory and run it. It
> doesn't depend on any other software being installed.
>
> FairUse is DVD backup software. It creates DivX files from DVDs in an
> automated wizard like fashion.
>
> I wonder if you would want to take a look at it?
>
> http://www.doom9.org/Soft21/Files/Encoders/FairUse_0.26_Beta.zip
>
> The "problem" now is that it gets to a point early on and the "Next"
> button remains greyed out.
I have now implemented SC_GET_DISK_INFO.
This also merges some pending ASPI fixes from my tree, experienced
with other DVD Players.
Ciao, Marcus
Changelog:
Some ASPI fixes, SC_GET_DISK_INFO stubbed, but returning sucess,
ASPI buffer allocation/free implemented.
Index: include/wnaspi32.h
===================================================================
RCS file: /home/wine/wine/include/wnaspi32.h,v
retrieving revision 1.11
diff -u -r1.11 wnaspi32.h
--- include/wnaspi32.h 2000/12/09 03:15:34 1.11
+++ include/wnaspi32.h 2001/06/04 19:22:50
@@ -198,14 +198,23 @@
SRB_Abort abort;
SRB_BusDeviceReset reset;
SRB_GDEVBlock devtype;
+ SRB_GetDiskInfo diskinfo;
} SRB, *PSRB, *LPSRB;
+typedef struct tagASPI32BUFF {
+ LPBYTE AB_BufPointer; /* pointer to buffer */
+ DWORD AB_BufLen; /* length of buffer */
+ DWORD AB_ZeroFill; /* set to 1 if zeroing */
+ DWORD AB_Reserved; /* 0 */
+} ASPI32BUFF, *PASPI32BUFF;
+
#include "poppack.h"
/* Prototypes */
extern DWORD __cdecl SendASPI32Command (PSRB);
extern DWORD __cdecl GetASPI32SupportInfo (void);
extern DWORD __cdecl GetASPI32DLLVersion(void);
+extern BOOL __cdecl GetASPI32Buffer(PASPI32BUFF pab);
#ifdef __cplusplus
}
Index: dlls/winaspi/winaspi32.c
===================================================================
RCS file: /home/wine/wine/dlls/winaspi/winaspi32.c,v
retrieving revision 1.15
diff -u -r1.15 winaspi32.c
--- dlls/winaspi/winaspi32.c 2001/05/14 20:09:38 1.15
+++ dlls/winaspi/winaspi32.c 2001/06/04 19:22:50
@@ -82,12 +82,14 @@
}
LeaveCriticalSection(&ASPI_CritSection);
+ if (prb->SRB_HaId > ASPI_GetNumControllers())
+ return -1;
+
hc = ASPI_GetHCforController( prb->SRB_HaId );
fd = SCSI_OpenDevice( HIWORD(hc), LOWORD(hc), prb->SRB_Target, prb->SRB_Lun);
- if (fd == -1) {
+ if (fd == -1)
return -1;
- }
/* device is now open */
/* FIXME: Let users specify SCSI timeout in registry */
@@ -276,6 +287,7 @@
ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB)
{
struct sg_header *sg_hd, *sg_reply_hdr;
+ WORD ret;
DWORD status;
int in_len, out_len;
int error_code = 0;
@@ -286,7 +298,7 @@
#define MAKE_TARGET_TO_HOST(lpPRB) \
if (!TARGET_TO_HOST(lpPRB)) { \
WARN("program was not sending target_to_host for cmd %x (flags=%x),correcting.\n",lpPRB->CDBByte[0],lpPRB->SRB_Flags); \
- lpPRB->SRB_Flags |= 8; \
+ lpPRB->SRB_Flags |= 0x08; \
}
#define MAKE_HOST_TO_TARGET(lpPRB) \
if (!HOST_TO_TARGET(lpPRB)) { \
@@ -313,6 +325,12 @@
break;
}
ASPI_DebugPrintCmd(lpPRB);
+ if (lpPRB->SRB_HaId > ASPI_GetNumControllers()) {
+ ERR("Failed: Wanted hostadapter %d, but we have only %d.\n",
+ lpPRB->SRB_HaId,ASPI_GetNumControllers()
+ );
+ return WNASPI32_DoPosting( lpPRB, SS_INVALID_HA );
+ }
fd = ASPI_OpenDevice(lpPRB);
if (fd == -1) {
return WNASPI32_DoPosting( lpPRB, SS_NO_DEVICE );
@@ -415,9 +433,21 @@
ASPI_DebugPrintResult(lpPRB);
/* now do posting */
- return WNASPI32_DoPosting( lpPRB, SRB_Status );
+ ret = WNASPI32_DoPosting( lpPRB, SRB_Status );
+
+ switch (lpPRB->CDBByte[0]) {
+ case CMD_INQUIRY:
+ if (SRB_Status == SS_COMP)
+ return SS_COMP; /* some junk expects ss_comp here. */
+ /*FALLTHROUGH*/
+ default:
+ /*FALLTHROUGH*/
+ }
+
/* In real WNASPI32 stuff really is always pending because ASPI does things
in the background, but we are not doing that (yet) */
+
+ return ret;
error_exit:
SRB_Status = SS_ERR;
@@ -452,9 +482,12 @@
*/
DWORD __cdecl GetASPI32SupportInfo(void)
{
- return ((SS_COMP << 8) | ASPI_GetNumControllers());
-}
+ DWORD controllers = ASPI_GetNumControllers();
+ if (!controllers)
+ return SS_NO_ADAPTERS << 8;
+ return (SS_COMP << 8) | controllers ;
+}
/***********************************************************************
* SendASPI32Command (WNASPI32.1)
@@ -465,7 +498,7 @@
switch (lpSRB->common.SRB_Cmd) {
case SC_HA_INQUIRY:
lpSRB->inquiry.SRB_Status = SS_COMP; /* completed successfully */
- lpSRB->inquiry.HA_Count = 1; /* not always */
+ lpSRB->inquiry.HA_Count = ASPI_GetNumControllers();
lpSRB->inquiry.HA_SCSI_ID = 7; /* not always ID 7 */
strcpy(lpSRB->inquiry.HA_ManagerId, "ASPI for WIN32"); /* max 15 chars, don't change */
strcpy(lpSRB->inquiry.HA_Identifier, "Wine host"); /* FIXME: return host adapter name */
@@ -517,12 +550,13 @@
case SC_RESET_DEV:
FIXME("Not implemented SC_RESET_DEV\n");
break;
-#ifdef SC_GET_DISK_INFO
case SC_GET_DISK_INFO:
- /* NT Doesn't implement this either.. so don't feel bad */
- FIXME("Not implemented SC_GET_DISK_INFO\n");
- break;
-#endif
+ /* here we have to find out the int13 / bios association.
+ * We just say we do not have any.
+ */
+ FIXME("SC_GET_DISK_INFO always return 'int13 unassociated disk'.\n");
+ lpSRB->diskinfo.SRB_DriveFlags = 0; /* disk is not int13 served */
+ return SS_COMP;
default:
FIXME("Unknown command %d\n", lpSRB->common.SRB_Cmd);
}
@@ -549,19 +583,26 @@
/***********************************************************************
* GetASPI32Buffer (WNASPI32.@)
+ * Supposed to return a DMA capable large SCSI buffer.
+ * Our implementation does not use those at all, all buffer stuff is
+ * done in the kernel SG device layer. So we just heapalloc the buffer.
*/
-BOOL __cdecl GetASPI32Buffer(LPVOID pab) /* [???] FIXME: PASPI32BUFF */
+BOOL __cdecl GetASPI32Buffer(PASPI32BUFF pab)
{
- FIXME("(%p), stub !\n", pab);
+ pab->AB_BufPointer = HeapAlloc(GetProcessHeap(),
+ pab->AB_ZeroFill?HEAP_ZERO_MEMORY:0,
+ pab->AB_BufLen
+ );
+ if (!pab->AB_BufPointer) return FALSE;
return TRUE;
}
/***********************************************************************
* FreeASPI32Buffer (WNASPI32.@)
*/
-BOOL __cdecl FreeASPI32Buffer(LPVOID pab) /* [???] FIXME: PASPI32BUFF */
+BOOL __cdecl FreeASPI32Buffer(PASPI32BUFF pab)
{
- FIXME("(%p), stub !\n", pab);
+ HeapFree(GetProcessHeap(),0,pab->AB_BufPointer);
return TRUE;
}
More information about the wine-patches
mailing list