Finish any pending WaitCommEvents if the event mask is set to 0.
[wine.git] / dlls / winaspi / winaspi32.c
blob7d3a33de7e80c81dea91fe02362c9734557767af
1 /*
2 * Copyright 1997 Bruce Milner
3 * Copyright 1998 Andreas Mohr
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "config.h"
22 #include <assert.h>
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <sys/types.h>
26 #include <errno.h>
27 #include <fcntl.h>
28 #include <memory.h>
29 #include <unistd.h>
31 #include "winbase.h"
32 #include "aspi.h"
33 #include "wnaspi32.h"
34 #include "winescsi.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(aspi);
39 /* FIXME!
40 * 1) Residual byte length reporting not handled
41 * 2) Make this code re-entrant for multithreading
42 * -- Added CriticalSection to OpenDevices function
43 * 3) Only linux supported so far
44 * 4) Leaves sg devices open. This may or may not be okay. A better solution
45 * would be to close the file descriptors when the thread/process using
46 * them no longer needs them.
49 #ifdef linux
51 static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
52 static CRITICAL_SECTION ASPI_CritSection = CRITICAL_SECTION_INIT("ASPI_CritSection");
54 #endif /* defined(linux) */
57 BOOL WINAPI WNASPI32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
59 #ifdef linux
60 switch( fdwReason )
62 case DLL_PROCESS_ATTACH:
63 SCSI_Init();
64 break;
65 case DLL_PROCESS_DETACH:
66 DeleteCriticalSection( &ASPI_CritSection );
67 break;
68 case DLL_THREAD_ATTACH:
69 case DLL_THREAD_DETACH:
70 break;
72 #endif /* defined(linux) */
73 return TRUE;
77 #ifdef linux
79 static int
80 ASPI_OpenDevice(SRB_ExecSCSICmd *prb)
82 int fd;
83 DWORD hc;
84 ASPI_DEVICE_INFO *curr;
86 /* search list of devices to see if we've opened it already.
87 * There is not an explicit open/close in ASPI land, so hopefully
88 * keeping a device open won't be a problem.
91 EnterCriticalSection(&ASPI_CritSection);
92 for (curr = ASPI_open_devices; curr; curr = curr->next) {
93 if (curr->hostId == prb->SRB_HaId &&
94 curr->target == prb->SRB_Target &&
95 curr->lun == prb->SRB_Lun) {
96 LeaveCriticalSection(&ASPI_CritSection);
97 return curr->fd;
100 LeaveCriticalSection(&ASPI_CritSection);
102 if (prb->SRB_HaId > ASPI_GetNumControllers())
103 return -1;
105 hc = ASPI_GetHCforController( prb->SRB_HaId );
106 fd = SCSI_OpenDevice( HIWORD(hc), LOWORD(hc), prb->SRB_Target, prb->SRB_Lun);
108 if (fd == -1)
109 return -1;
111 /* device is now open */
112 /* FIXME: Let users specify SCSI timeout in registry */
113 SCSI_LinuxSetTimeout( fd, SCSI_DEFAULT_TIMEOUT );
115 curr = HeapAlloc( GetProcessHeap(), 0, sizeof(ASPI_DEVICE_INFO) );
116 curr->fd = fd;
117 curr->hostId = prb->SRB_HaId;
118 curr->target = prb->SRB_Target;
119 curr->lun = prb->SRB_Lun;
121 /* insert new record at beginning of open device list */
122 EnterCriticalSection(&ASPI_CritSection);
123 curr->next = ASPI_open_devices;
124 ASPI_open_devices = curr;
125 LeaveCriticalSection(&ASPI_CritSection);
126 return fd;
130 static void
131 ASPI_DebugPrintCmd(SRB_ExecSCSICmd *prb)
133 BYTE cmd;
134 int i;
135 BYTE *cdb;
137 switch (prb->CDBByte[0]) {
138 case CMD_INQUIRY:
139 TRACE("INQUIRY {\n");
140 TRACE("\tEVPD: %d\n", prb->CDBByte[1] & 1);
141 TRACE("\tLUN: %d\n", (prb->CDBByte[1] & 0xc) >> 1);
142 TRACE("\tPAGE CODE: %d\n", prb->CDBByte[2]);
143 TRACE("\tALLOCATION LENGTH: %d\n", prb->CDBByte[4]);
144 TRACE("\tCONTROL: %d\n", prb->CDBByte[5]);
145 TRACE("}\n");
146 break;
147 case CMD_SCAN_SCAN:
148 TRACE("Transfer Length: %d\n", prb->CDBByte[4]);
149 break;
152 TRACE("Host Adapter: %d\n", prb->SRB_HaId);
153 TRACE("Flags: %d\n", prb->SRB_Flags);
154 if (TARGET_TO_HOST(prb)) {
155 TRACE("\tData transfer: Target to host. Length checked.\n");
157 else if (HOST_TO_TARGET(prb)) {
158 TRACE("\tData transfer: Host to target. Length checked.\n");
160 else if (NO_DATA_TRANSFERED(prb)) {
161 TRACE("\tData transfer: none\n");
163 else {
164 WARN("\tTransfer by scsi cmd. Length not checked.\n");
167 TRACE("\tResidual byte length reporting %s\n", prb->SRB_Flags & 0x4 ? "enabled" : "disabled");
168 TRACE("\tLinking %s\n", prb->SRB_Flags & 0x2 ? "enabled" : "disabled");
169 TRACE("\tPosting %s\n", prb->SRB_Flags & 0x1 ? "enabled" : "disabled");
170 TRACE("Target: %d\n", prb->SRB_Target);
171 TRACE("Lun: %d\n", prb->SRB_Lun);
172 TRACE("BufLen: %ld\n", prb->SRB_BufLen);
173 TRACE("SenseLen: %d\n", prb->SRB_SenseLen);
174 TRACE("BufPtr: %p\n", prb->SRB_BufPointer);
175 TRACE("CDB Length: %d\n", prb->SRB_CDBLen);
176 TRACE("POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
177 cdb = &prb->CDBByte[0];
178 cmd = prb->CDBByte[0];
179 if (TRACE_ON(aspi)) {
180 DPRINTF("CDB buffer[");
181 for (i = 0; i < prb->SRB_CDBLen; i++) {
182 if (i != 0) DPRINTF(",");
183 DPRINTF("%02x", *cdb++);
185 DPRINTF("]\n");
189 static void
190 ASPI_PrintCDBArea(SRB_ExecSCSICmd *prb)
192 if (TRACE_ON(aspi))
194 int i;
195 DPRINTF("CDB[");
196 for (i = 0; i < prb->SRB_CDBLen; i++) {
197 if (i) DPRINTF(",");
198 DPRINTF("%02x", prb->CDBByte[i]);
200 DPRINTF("]\n");
204 static void
205 ASPI_PrintSenseArea(SRB_ExecSCSICmd *prb)
207 int i;
208 BYTE *rqbuf = prb->SenseArea;
210 if (TRACE_ON(aspi))
212 DPRINTF("Request Sense reports:\n");
213 if ((rqbuf[0]&0x7f)!=0x70) {
214 DPRINTF("\tInvalid sense header: 0x%02x instead of 0x70\n", rqbuf[0]&0x7f);
215 return;
217 DPRINTF("\tCurrent command read filemark: %s\n",(rqbuf[2]&0x80)?"yes":"no");
218 DPRINTF("\tEarly warning passed: %s\n",(rqbuf[2]&0x40)?"yes":"no");
219 DPRINTF("\tIncorrect blocklength: %s\n",(rqbuf[2]&0x20)?"yes":"no");
220 DPRINTF("\tSense Key: %d\n",rqbuf[2]&0xf);
221 if (rqbuf[0]&0x80)
222 DPRINTF("\tResidual Length: %d\n",rqbuf[3]*0x1000000+rqbuf[4]*0x10000+rqbuf[5]*0x100+rqbuf[6]);
223 DPRINTF("\tAdditional Sense Length: %d\n",rqbuf[7]);
224 DPRINTF("\tAdditional Sense Code: %d\n",rqbuf[12]);
225 DPRINTF("\tAdditional Sense Code Qualifier: %d\n",rqbuf[13]);
226 if (rqbuf[15]&0x80) {
227 DPRINTF("\tIllegal Param is in %s\n",(rqbuf[15]&0x40)?"the CDB":"the Data Out Phase");
228 if (rqbuf[15]&0x8) {
229 DPRINTF("Pointer at %d, bit %d\n",rqbuf[16]*256+rqbuf[17],rqbuf[15]&0x7);
232 DPRINTF("SenseArea[");
233 for (i = 0; i < prb->SRB_SenseLen; i++) {
234 if (i) DPRINTF(",");
235 DPRINTF("%02x", *rqbuf++);
237 DPRINTF("]\n");
241 static void
242 ASPI_DebugPrintResult(SRB_ExecSCSICmd *prb)
245 TRACE("SRB_Status: %x\n", prb->SRB_Status);
246 TRACE("SRB_HaStat: %x\n", prb->SRB_HaStat);
247 TRACE("SRB_TargStat: %x\n", prb->SRB_TargStat);
248 switch (prb->CDBByte[0]) {
249 case CMD_INQUIRY:
250 TRACE("Vendor: '%s'\n", prb->SRB_BufPointer + INQUIRY_VENDOR);
251 break;
252 case CMD_TEST_UNIT_READY:
253 ASPI_PrintSenseArea(prb);
254 break;
258 /* Posting must be done in such a way that as soon as the SRB_Status is set
259 * we don't touch the SRB anymore because it could possibly be freed
260 * if the app is doing ASPI polling
262 static DWORD
263 WNASPI32_DoPosting( SRB_ExecSCSICmd *lpPRB, DWORD status )
265 void (*SRB_PostProc)() = lpPRB->SRB_PostProc;
266 BYTE SRB_Flags = lpPRB->SRB_Flags;
267 if( status == SS_PENDING )
269 WARN("Tried posting SS_PENDING\n");
270 return SS_PENDING;
272 lpPRB->SRB_Status = status;
273 /* lpPRB is NOT safe, it could be freed in another thread */
275 if (SRB_PostProc)
277 if (SRB_Flags & 0x1)
279 TRACE("Post Routine (%lx) called\n", (DWORD) SRB_PostProc);
280 /* Even though lpPRB could have been freed by
281 * the program.. that's unlikely if it planned
282 * to use it in the PostProc
284 (*SRB_PostProc)(lpPRB);
286 else if (SRB_Flags & SRB_EVENT_NOTIFY) {
287 TRACE("Setting event %04x\n", (HANDLE)SRB_PostProc);
288 SetEvent((HANDLE)SRB_PostProc);
291 return SS_PENDING;
294 static WORD
295 ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB)
297 struct sg_header *sg_hd, *sg_reply_hdr;
298 WORD ret;
299 DWORD status;
300 int in_len, out_len;
301 int error_code = 0;
302 int fd;
303 DWORD SRB_Status;
305 /* FIXME: hackmode */
306 #define MAKE_TARGET_TO_HOST(lpPRB) \
307 if (!TARGET_TO_HOST(lpPRB)) { \
308 WARN("program was not sending target_to_host for cmd %x (flags=%x),correcting.\n",lpPRB->CDBByte[0],lpPRB->SRB_Flags); \
309 lpPRB->SRB_Flags |= 0x08; \
311 #define MAKE_HOST_TO_TARGET(lpPRB) \
312 if (!HOST_TO_TARGET(lpPRB)) { \
313 WARN("program was not sending host_to_target for cmd %x (flags=%x),correcting.\n",lpPRB->CDBByte[0],lpPRB->SRB_Flags); \
314 lpPRB->SRB_Flags |= 0x10; \
316 switch (lpPRB->CDBByte[0]) {
317 case 0x12: /* INQUIRY */
318 case 0x5a: /* MODE_SENSE_10 */
319 case 0xa4: /* REPORT_KEY (DVD) MMC-2 */
320 case 0xad: /* READ DVD STRUCTURE MMC-2 */
321 MAKE_TARGET_TO_HOST(lpPRB)
322 break;
323 case 0xa3: /* SEND KEY (DVD) MMC-2 */
324 MAKE_HOST_TO_TARGET(lpPRB)
325 break;
326 default:
327 if ((((lpPRB->SRB_Flags & 0x18) == 0x00) ||
328 ((lpPRB->SRB_Flags & 0x18) == 0x18)
329 ) && lpPRB->SRB_BufLen
331 FIXME("command 0x%02x, no data transfer specified, but buflen is %ld!!!\n",lpPRB->CDBByte[0],lpPRB->SRB_BufLen);
333 break;
335 ASPI_DebugPrintCmd(lpPRB);
336 if (lpPRB->SRB_HaId > ASPI_GetNumControllers()) {
337 ERR("Failed: Wanted hostadapter %d, but we have only %d.\n",
338 lpPRB->SRB_HaId,ASPI_GetNumControllers()
340 return WNASPI32_DoPosting( lpPRB, SS_INVALID_HA );
342 fd = ASPI_OpenDevice(lpPRB);
343 if (fd == -1) {
344 return WNASPI32_DoPosting( lpPRB, SS_NO_DEVICE );
347 sg_hd = NULL;
348 sg_reply_hdr = NULL;
350 lpPRB->SRB_Status = SS_PENDING;
352 if (!lpPRB->SRB_CDBLen) {
353 ERR("Failed: lpPRB->SRB_CDBLen = 0.\n");
354 return WNASPI32_DoPosting( lpPRB, SS_INVALID_SRB );
357 /* build up sg_header + scsi cmd */
358 if (HOST_TO_TARGET(lpPRB)) {
359 /* send header, command, and then data */
360 in_len = SCSI_OFF + lpPRB->SRB_CDBLen + lpPRB->SRB_BufLen;
361 sg_hd = (struct sg_header *) HeapAlloc(GetProcessHeap(), 0, in_len);
362 memset(sg_hd, 0, SCSI_OFF);
363 memcpy(sg_hd + 1, &lpPRB->CDBByte[0], lpPRB->SRB_CDBLen);
364 if (lpPRB->SRB_BufLen) {
365 memcpy(((BYTE *) sg_hd) + SCSI_OFF + lpPRB->SRB_CDBLen, lpPRB->SRB_BufPointer, lpPRB->SRB_BufLen);
368 else {
369 /* send header and command - no data */
370 in_len = SCSI_OFF + lpPRB->SRB_CDBLen;
371 sg_hd = (struct sg_header *) HeapAlloc(GetProcessHeap(), 0, in_len);
372 memset(sg_hd, 0, SCSI_OFF);
373 memcpy(sg_hd + 1, &lpPRB->CDBByte[0], lpPRB->SRB_CDBLen);
376 if (TARGET_TO_HOST(lpPRB)) {
377 out_len = SCSI_OFF + lpPRB->SRB_BufLen;
378 sg_reply_hdr = (struct sg_header *) HeapAlloc(GetProcessHeap(), 0, out_len);
379 memset(sg_reply_hdr, 0, SCSI_OFF);
380 sg_hd->reply_len = out_len;
382 else {
383 out_len = SCSI_OFF;
384 sg_reply_hdr = (struct sg_header *) HeapAlloc(GetProcessHeap(), 0, out_len);
385 memset(sg_reply_hdr, 0, SCSI_OFF);
386 sg_hd->reply_len = out_len;
389 SCSI_Fix_CMD_LEN(fd, lpPRB->CDBByte[0], lpPRB->SRB_CDBLen);
391 if(!SCSI_LinuxDeviceIo( fd,
392 sg_hd, in_len,
393 sg_reply_hdr, out_len,
394 &status) )
396 goto error_exit;
399 if (sg_reply_hdr->result != 0) {
400 error_code = sg_reply_hdr->result;
401 WARN("reply header error (%d)\n", sg_reply_hdr->result);
402 goto error_exit;
405 if (TARGET_TO_HOST(lpPRB) && lpPRB->SRB_BufLen) {
406 memcpy(lpPRB->SRB_BufPointer, sg_reply_hdr + 1, lpPRB->SRB_BufLen);
409 /* copy in sense buffer to amount that is available in client */
410 if (lpPRB->SRB_SenseLen) {
411 int sense_len = lpPRB->SRB_SenseLen;
412 if (lpPRB->SRB_SenseLen > 16)
413 sense_len = 16;
415 /* CDB is fixed in WNASPI32 */
416 memcpy(lpPRB->SenseArea, &sg_reply_hdr->sense_buffer[0], sense_len);
418 ASPI_PrintCDBArea(lpPRB);
419 ASPI_PrintSenseArea(lpPRB);
422 SRB_Status = SS_COMP;
423 lpPRB->SRB_HaStat = HASTAT_OK;
424 lpPRB->SRB_TargStat = sg_reply_hdr->target_status << 1;
426 HeapFree(GetProcessHeap(), 0, sg_reply_hdr);
427 HeapFree(GetProcessHeap(), 0, sg_hd);
429 /* FIXME: Should this be != 0 maybe? */
430 if( lpPRB->SRB_TargStat == 2 ) {
431 SRB_Status = SS_ERR;
432 switch (lpPRB->CDBByte[0]) {
433 case 0xa4: /* REPORT_KEY (DVD) MMC-2 */
434 case 0xa3: /* SEND KEY (DVD) MMC-2 */
435 SRB_Status = SS_COMP;
436 lpPRB->SRB_TargStat = 0;
437 FIXME("Program wants to do DVD Region switching, but fails (non compliant DVD drive). Ignoring....\n");
438 break;
442 ASPI_DebugPrintResult(lpPRB);
443 /* now do posting */
444 ret = WNASPI32_DoPosting( lpPRB, SRB_Status );
446 switch (lpPRB->CDBByte[0]) {
447 case CMD_INQUIRY:
448 if (SRB_Status == SS_COMP)
449 return SS_COMP; /* some junk expects ss_comp here. */
450 /*FALLTHROUGH*/
451 default:
452 break;
455 /* In real WNASPI32 stuff really is always pending because ASPI does things
456 in the background, but we are not doing that (yet) */
458 return ret;
460 error_exit:
461 SRB_Status = SS_ERR;
462 if (error_code == EBUSY) {
463 WNASPI32_DoPosting( lpPRB, SS_ASPI_IS_BUSY );
464 TRACE("Device busy\n");
465 } else
466 FIXME("Failed\n");
468 /* I'm not sure exactly error codes work here
469 * We probably should set lpPRB->SRB_TargStat, SRB_HaStat ?
471 WARN("error_exit\n");
472 HeapFree(GetProcessHeap(), 0, sg_reply_hdr);
473 HeapFree(GetProcessHeap(), 0, sg_hd);
474 WNASPI32_DoPosting( lpPRB, SRB_Status );
475 return SS_PENDING;
478 #endif /* defined(linux) */
481 /*******************************************************************
482 * GetASPI32SupportInfo [WNASPI32.1]
484 * Checks if the ASPI subsystem is initialized correctly.
486 * RETURNS
487 * HIWORD: 0.
488 * HIBYTE of LOWORD: status (SS_COMP or SS_FAILED_INIT)
489 * LOBYTE of LOWORD: # of host adapters.
491 DWORD __cdecl GetASPI32SupportInfo(void)
493 DWORD controllers = ASPI_GetNumControllers();
495 if (!controllers)
496 return SS_NO_ADAPTERS << 8;
497 return (SS_COMP << 8) | controllers ;
500 /***********************************************************************
501 * SendASPI32Command (WNASPI32.2)
503 DWORD __cdecl SendASPI32Command(LPSRB lpSRB)
505 #ifdef linux
506 switch (lpSRB->common.SRB_Cmd) {
507 case SC_HA_INQUIRY:
508 lpSRB->inquiry.SRB_Status = SS_COMP; /* completed successfully */
509 lpSRB->inquiry.HA_Count = ASPI_GetNumControllers();
510 lpSRB->inquiry.HA_SCSI_ID = 7; /* not always ID 7 */
511 strcpy(lpSRB->inquiry.HA_ManagerId, "ASPI for WIN32"); /* max 15 chars, don't change */
512 strcpy(lpSRB->inquiry.HA_Identifier, "Wine host"); /* FIXME: return host adapter name */
513 memset(lpSRB->inquiry.HA_Unique, 0, 16); /* default HA_Unique content */
514 lpSRB->inquiry.HA_Unique[6] = 0x02; /* Maximum Transfer Length (128K, Byte> 4-7) */
515 lpSRB->inquiry.HA_Unique[3] = 0x08; /* Maximum number of SCSI targets */
516 FIXME("ASPI: Partially implemented SC_HA_INQUIRY for adapter %d.\n", lpSRB->inquiry.SRB_HaId);
517 return SS_COMP;
519 case SC_GET_DEV_TYPE: {
520 /* FIXME: We should return SS_NO_DEVICE if the device is not configured */
521 /* FIXME: We should return SS_INVALID_HA if HostAdapter!=0 */
522 SRB tmpsrb;
523 char inqbuf[200];
524 DWORD ret;
526 memset(&tmpsrb,0,sizeof(tmpsrb));
528 /* Copy header */
529 memcpy(&tmpsrb.common,&(lpSRB->common),sizeof(tmpsrb.common));
531 tmpsrb.cmd.SRB_Flags |= 8; /* target to host */
532 tmpsrb.cmd.SRB_Cmd = SC_EXEC_SCSI_CMD;
533 tmpsrb.cmd.SRB_Target = lpSRB->devtype.SRB_Target;
534 tmpsrb.cmd.SRB_Lun = lpSRB->devtype.SRB_Lun;
535 tmpsrb.cmd.SRB_BufLen = sizeof(inqbuf);
536 tmpsrb.cmd.SRB_BufPointer = inqbuf;
537 tmpsrb.cmd.CDBByte[0] = 0x12; /* INQUIRY */
538 /* FIXME: handle lun */
539 tmpsrb.cmd.CDBByte[4] = sizeof(inqbuf);
540 tmpsrb.cmd.SRB_CDBLen = 6;
542 ret = ASPI_ExecScsiCmd(&tmpsrb.cmd);
544 lpSRB->devtype.SRB_Status = tmpsrb.cmd.SRB_Status;
545 lpSRB->devtype.SRB_DeviceType = inqbuf[0]&0x1f;
547 TRACE("returning devicetype %d for target %d\n",inqbuf[0]&0x1f,tmpsrb.cmd.SRB_Target);
548 if (ret!=SS_PENDING) /* Any error is passed down directly */
549 return ret;
550 /* FIXME: knows that the command is finished already, pass final Status */
551 return tmpsrb.cmd.SRB_Status;
553 case SC_EXEC_SCSI_CMD:
554 return ASPI_ExecScsiCmd(&lpSRB->cmd);
555 case SC_ABORT_SRB:
556 FIXME("Not implemented SC_ABORT_SRB\n");
557 break;
558 case SC_RESET_DEV:
559 FIXME("Not implemented SC_RESET_DEV\n");
560 break;
561 case SC_GET_DISK_INFO:
562 /* here we have to find out the int13 / bios association.
563 * We just say we do not have any.
565 FIXME("SC_GET_DISK_INFO always return 'int13 unassociated disk'.\n");
566 lpSRB->diskinfo.SRB_DriveFlags = 0; /* disk is not int13 served */
567 return SS_COMP;
568 default:
569 FIXME("Unknown command %d\n", lpSRB->common.SRB_Cmd);
571 return SS_INVALID_SRB;
572 #else
573 return SS_INVALID_SRB;
574 #endif
578 /***********************************************************************
579 * GetASPI32DLLVersion (WNASPI32.4)
581 DWORD __cdecl GetASPI32DLLVersion(void)
583 #ifdef linux
584 TRACE("Returning version 1\n");
585 return (DWORD)1;
586 #else
587 FIXME("Please add SCSI support for your operating system, returning 0\n");
588 return (DWORD)0;
589 #endif
592 /***********************************************************************
593 * GetASPI32Buffer (WNASPI32.8)
594 * Supposed to return a DMA capable large SCSI buffer.
595 * Our implementation does not use those at all, all buffer stuff is
596 * done in the kernel SG device layer. So we just heapalloc the buffer.
598 BOOL __cdecl GetASPI32Buffer(PASPI32BUFF pab)
600 pab->AB_BufPointer = HeapAlloc(GetProcessHeap(),
601 pab->AB_ZeroFill?HEAP_ZERO_MEMORY:0,
602 pab->AB_BufLen
604 if (!pab->AB_BufPointer) return FALSE;
605 return TRUE;
608 /***********************************************************************
609 * FreeASPI32Buffer (WNASPI32.14)
611 BOOL __cdecl FreeASPI32Buffer(PASPI32BUFF pab)
613 HeapFree(GetProcessHeap(),0,pab->AB_BufPointer);
614 return TRUE;
617 /***********************************************************************
618 * TranslateASPI32Address (WNASPI32.7)
620 BOOL __cdecl TranslateASPI32Address(LPDWORD pdwPath, LPDWORD pdwDEVNODE)
622 FIXME("(%p, %p), stub !\n", pdwPath, pdwDEVNODE);
623 return TRUE;