Oppure

Loading
06/02/09 23:46
Thejuster
Salve chiedo aiuto mediante questo mio grande blocco

attualmente mi trovo difronte ad un ostacolo
non riesco in nessun modo a far funzionare questa classe com.

vi mostro il mio sorgente

 Enum GrfErrorType
        GE_SUCCESS
        GE_BADARGS
        GE_INVALID
        GE_CORRUPTED
        GE_NSUP
        GE_NOTFOUND
        GE_INDEX
        GE_ERRNO
        GE_ZLIB
        GE_ZLIBFILE
        GE_NODATA
        GE_BADMODE
        GE_NOTIMPLEMENTED
    End Enum


    Public Structure GrfError
        Dim type As GrfErrorType
        Dim line As Integer
        Dim name As String
        Dim func As String
        Dim extra As Int64
    End Structure

    Public Structure GrfFile
        Dim compressed_len_aligned As Integer
        Dim compressed_len As Integer
        Dim real_len As Integer
        Dim flags As Int16
        Dim hash As Integer
        Dim name As String
        Dim data As String
    End Structure

    Public Structure Grf
        Dim filename As String
        Dim len As Integer
        Dim type As Integer
        Dim version As Integer
        Dim nfiles As Integer
        Dim files() As GrfFile
        Dim first As GrfFile
        Dim last As GrfFile

        Dim allowCrypt As Int16
        Dim f As System.IO.File
        Dim allowWrite As Int16
        Dim zbuf As Object ' void
    End Structure

    Public Structure GrfOpenCallback
        Dim file As GrfFile
        Dim mError As GrfError
    End Structure

    ' GRF Library (grf.dll) Funzioni
    Public Declare Function GrfOpen Lib "grf.dll" Alias "grf_open" (ByVal fname As String, ByVal mode As String, ByVal mError As GrfError, ByVal callback As GrfOpenCallback) As Grf
    'Public Declare Function GrfOpen Lib "grf.dll" Alias "grf_open_callback" (ByVal fname As String, ByVal mode As String, ByVal mError As GrfError, ByVal callback As IntPtr) As Grf
    Public Declare Function GrfExtract Lib "grf.dll" Alias "grf_extract" (ByVal grf As Grf, ByVal grfname As String, ByVal file As String, ByVal mError As GrfError) As Integer
    Public Declare Function GrfClose Lib "grf.dll" Alias "grf_close" (ByVal grf As Grf)
    Public Declare Function GrfFree Lib "grf.dll" Alias "grf_free" (ByVal grf As Grf)

    Sub Main()
        Try
            Dim myGrf As Grf
            Dim err As GrfError
            Dim cb As GrfOpenCallback
            myGrf = GrfOpen("data.gpf", "rb", err, cb)




        Catch ex As Exception
            MsgBox(ex.ToString)

        End Try
    End Sub


in pratica sarebbe un file rar criptato ed usato per molti giochi.

e tipo ad una folder virtuale,
credo che questo tipo di file venga usato molto sulle directX per immagazzinare dati, audio, video e suoni.

l'errore che mi dà e codesto



System.Runtime.InteropServices.MarshalDirectiveException:
La firma del tipo del metodo non è compatibile con PInvoke.

l'errore lo restituisce al grfOpen

vi rilasco anche i sorgenti della classe come.


forse sarà un problema del c
che non puo far ritornare come valore un puntatore non saprei

spero che mi possiate aiutare
grazie mille.

Ultima modifica effettuata da Thejuster 07/02/09 0:19
mire.forumfree.it/ - Mire Engine
C# UI Designer
07/02/09 16:46
Il Totem
L'errore viene generato dal marshaler quando incontra un attributo MarshalAs che non sa gestire (preso da msdn). Dato che questo attributo specifica verso quale tipo di dato debba essere esportato un campo per il marshaling, presumo che la dichiarazione dei tipi non sia esatta, o non sia supportata... Ma anche disponendo del COMponente (XD), non credo di essere in grado di dire di più.
aaa