I'm trying to port API from c++ to c#

* Original title: porting method

I'm trying to port API from c++ to c#

In C++

HRESULT WINAPI BluetoothGATTGetServices)
HANDLE _In_ HDevice,
ServicesBufferCount _In_ USHORT,
_Out_opt_ PBTH_LE_GATT_SERVICE ServicesBuffer,
_Out_ USHORT * ServicesBufferActual,.
_In_ ULONG flags
);

typedef struct _BTH_LE_GATT_SERVICE {}
BTH_LE_UUID ServiceUuid;
USHORT AttributeHandle;
} BTH_LE_GATT_SERVICE, * PBTH_LE_GATT_SERVICE;

typedef struct _BTH_LE_UUID {}
BOOLEAN IsShortUuid;
USHORT ShortUuid;
GUID LongUuid;
} BTH_LE_UUID, * PBTH_LE_UUID;

I made this way in c#

[StructLayout (LayoutKind.sequential)]
struct BTH_LE_UUID
{
public Boolean IsShortUuid;
public ushort ShortUuid;
public Guid LongUuid;
};

[StructLayout (LayoutKind.sequential)]
struct BTH_LE_GATT_SERVICE
{
public BTH_LE_UUID ServiceUuid;
public ushort AttributeHandle;
};

[DllImport ("BluetoothApis.dll", PreserveSig = false)]
public static extern (long) BluetoothGATTGetServices
IntPtr hDevice,
UShort ServicesBufferCount,
the BTH_LE_GATT_SERVICE ServicesBuffer,
ushort ref ServicesBufferActual,
ULong flags
);

When I call

ushortserviceBufferCount = 0;

BTH_LE_GATT_SERVICE le_gatt_service = new BTH_LE_GATT_SERVICE();

long result = BluetoothGATTGetServices (hLEDevice, 0, a le_gatt_service, Ref serviceBufferCount, BLUETOOTH_GATT_FLAG_NONE);

I get a message

A call to PInvoke function ' BLE_Sniffer! BLE_Sniffer.ble::BluetoothGATTGetServices' has unbalanced the stack. It is probably because the managed PInvoke signature does not match the unmanaged target signature. Make sure that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

What is wrong with my code?

This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
*

Tags: Windows

Similar Questions

  • I am trying to download images from a compact flash player map, but every time my computer shows i/o device error. What does that mean?

    I am trying to download pictures from a card compact flash player map, but every time my computer shows i/o device error. What does that mean?

    Hi Richard,

    1. what version of Windows you are using on the computer?

    2. have you checked if the problem persists in a different USB port and in another computer?

    3 - is the card compact flash not detected in Device Manager?

    A Secure Digital or SD memory card is a device of small portable storage usually used on a digital camera or camcorder, cell phone, or computer system. When you use the card, you may sometimes experience an IO error. The term "i/o" is refers to an input/output error and may involve the SD itself card or the card reader you are using.

    Try these methods:

    Method 1: Try to run the hardware troubleshooter and check what the problem is and fix it accordingly.

    Follow the link below a convenience store opened.

    http://Windows.Microsoft.com/en-us/Windows7/open-the-hardware-and-devices-Troubleshooter

    Method 2:

    Eject the SD card in the card reader and check the writing on the side protection tab. This tab should be in the up position; otherwise, you will not be able to save all data on the card. Also check the connection between the computer and the SD card reader. If the card reader is not properly connected to the computer, you will receive error messages when you try to use the SD card or your computer does not recognize the card.

    Response with more information to help you. Back to us for any problem related to Windows. We will be happy to help you.

  • Thunking spooler APIs from 32 to 64 process has stopped working

    I get this error, Thunking spooler APIs from 32 to 64 process ceased to function, that when I try to print my bank statement which is in the format pdf from my Bank Web site. Otherwise I am able to print from other applications, including Microsoft Office 2000 applications. I am running Vista Home Premium 64 on a laptop Dell Inspiron very new. I already uninstalled the printer several times and that you have downloaded your uninstall cleanup utility, none of this has worked. In addition, no other threads in the forum seem to be like mine. I was able to print from this site as a first step, but are not able to since a few months now. Is this a compatibility issue with the software that is using my bank or is there another problem. My wife has a similar laptop with XP OS and I can print the declaration of his fine form.
    Thanks for any help on this matter.

    I just had the same problem a couple of days.  After uninstalling my printer drivers and reinstall, I always had the same problem.  I tried a few suggestions on these posts, but still nothing.  When I opened my printers in the Control Panel, I found three other printers listed two for quicken and Microsoft office, I deleted these (but not my original HP inkjet printer) and it worked. Hope this helps someone else.

  • I'm trying to uninstall iTunes from the PC with Windows 7, but get a message "the feature you are trying to use is on a network unavailable resource." How to get around this? (Apple don't give customer service!)

    For the third time! I'm trying to uninstall iTunes from my PC with Windows 7 Home Edition premium as the statement on Apple's site, but get a message "the feature you are trying to use is on a network resource that is unavailable." I'm then offered a chance to "try again or enter a different path to the folder that contains the package"iTunes6464.msi installation in the box below. " With my limited knowledge, I can't find such a record.

    For general advice, see troubleshooting problems with iTunes for Windows updates. Start by Missing MSI errors .

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    More information area has direct links with the current and recent buildings if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit-for old video cards) as a workaround for problems with installation or operation, or compatibility with QuickTime software or a third party.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • When I tried to import pictures from my camcorder videos seem to be import of Strontium.  After finished importing is not found the videos at all.  Any ideas?

    When I tried to import pictures from my camcorder videos seem to be importing into "Strontium".  After finished importing is not found the videos at all.  Any ideas?

    What is "strontium"?

    There are 9 different versions of iPhoto and they run on 10 different versions of the operating system. Tips and tricks for dealing with issues vary depending on the version of iPhoto and the version of the operating system. In order to get help, you need to give as much information as possible. Include things like:

    -What version of iPhoto.

    -What version of the operating system.

    -Details. Full, a description of the problem as you can. For example, if you have a problem with export, then explain by describing how you try to export and so on.

    -History: Is it going hard? Everything has been installed or removed? -Are there any error messages?

    -Have what measures you already tried to solve the problem.

    -Something unusual on configure your? Or how you use iPhoto?

    Anything else you can think of that could help someone understand the problem you have.

  • HP keyboard model kg-0851, I tried all the steps from hp, but the keyboard still does not

    I tried all the steps from hp, but the keyboard still does not.  When I look at the Device Manager, it says that it is fine.

    Hello

    1. what operating system is installed on the computer?
    2 have. what troubleshooting measures you tried?
    3. don't you make changes to the computer before the show?

    I suggest you try the steps from the following link:

    Mouse, touchpad and keyboard with Windows problems
    http://Windows.Microsoft.com/en-us/Windows/help/Mouse-touchpad-and-keyboard-problems-in-Windows

  • I'm trying to migrate data from a server to a new one with the file permissions of the files of users and records lost.

    original title: robocopy

    I'm trying to migrate data from a server to a new one with the file permissions of the files of users and records lost. So far, that's what I did, I used \\server1\share \\server2\share/sec /mir robocopy and robocopy \\server1\share \\serve2\share/e/s /copyall. It seams like they copied all files with the permissions of the user for the files, but not files. For example, if a user makes a folder with the files in the folder appear them have permissions appropriate for them but not the root folder or subfolders, they did... How can I fix this and what is the difference between / s /mir and/e/s /copyall?

    Hello

    You can find the Server forums on TechNet support, please create a new post at the following link:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • I am trying to print coupons from a Web site. It says I need I'm trying to install Coupon Activator. Then when I try, I get an error message. It will not let me install on my computer.

    I want to print coupons from my computer.  Activator coupon says I need to install it, when I try to install and run the program I get an error message.

    I am trying to print coupons from a Web site. I try to install Coupon Activator. Then when I try, I get an error message.  It will not let me install on my computer.

    Hi Dustin,

    Thanks for posting. You will have to contact the support for the program in which you can not install. If you encounter problems, install any programs please let us know with the exact error message.

    Thank you!
    Shawn - Support Engineer - MCP, MCDST
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • trying to export information from my phone to the pc, but it's prob givin

    OK nono help for export of blackberr info to pc

    Hello

    ·         What exactly happens when you try to export the phone info?

    ·         You get the error message?

    ·         You use any application when you export information from your phone?

    ·         What info are you trying to transfer from the phone to the computer?

    ·         Have you installed the BlackBerry Desktop Software?

    If you are trying to transfer pictures from phone to computer, you can check the link below:

    Import photos from your BlackBerry to your PC

    http://my.BlackBerry.com/tips/8172

    Also I suggest you to contact the Blackberry Support for assistance.

    http://us.BlackBerry.com/support/

  • Windows error when trying to download pictures from a camera

    Trying to download pictures from a digital camera olympus and get a windows error - never happened before.  By using the olympus software or copy the images to a desktop file still have a problem.  Can copy pictures on the desktop, see them, but then file freezes and can't open images or work with them.  Windows error info is: Code: 0xc0000005 flags: 0x00000000 save: 0 x 000000000000000 address: 0x000000007c9118e1

    I would like to know if there is more information that you need.  Have shutdown and restarted several times, have re-installed the olympus software, etc. - still get the error.

    Thanks for your help!

    Trying to download pictures from a digital camera olympus and get a windows error - never happened before.  By using the olympus software or copy the images to a desktop file still have a problem.  Can copy pictures on the desktop, see them, but then file freezes and can't open images or work with them.  Windows error info is: Code: 0xc0000005 flags: 0x00000000 save: 0 x 000000000000000 address: 0x000000007c9118e1

    I would like to know if there is more information that you need.  Have shutdown and restarted several times, have re-installed the olympus software, etc. - still get the error.

    Thanks for your help!

    were you on the website of Olympus and the down loaded the latest drivers for your camera.

    also, go to the MS Update site and run custom it can give you an update.

  • I am trying to export information from one site to the other; i.e. doba products to sell on ebay. I get an error telling me to "set associations"?

    I'm trying to export information from one site to another, i.e. the products to sell from doba to ebay.  I get an error telling me to "set associations"?

    Looks like a command prompt to set the default program for opening a certain type of file.

    This can be done in two contexts > Apps or right click on the Start button to open the Control Panel, choose the command display by: icons, then default programs.

  • Tried to download images from the camera. Unregistered class said. What is c?

    Trying to transfer photos from my camera in Windows Photo Gallery.  Pop - up said I couldn't because the class is not registered.  What does that mean?

    Hi John,.

    -When exactly you receive this error message?

    This problem occurs because a database is damaged. This database is created by Windows Live Photo Gallery to follow the photos and videos. To resolve this problem, use the following methods in the order in which they are presented. If method 1 does not resolve your problem, go to the next method.

    Method 1:

    Run the Fixit to solve problems with Windows Live Photo Gallery that does not work on Windows Vista.

    http://support.Microsoft.com/mats/windows_photo_and_slideshow_diag

    Method 2:

    Refer to the help article and check if that helps.

    Windows Live Photo Gallery crashes or won't start

    http://support.Microsoft.com/kb/944221

    Registry warning: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-the-registry

    Let us know the status of the issue. If you need help, please after return. We will be happy to help you.

  • trying to high grade from vista to 7 and my coputure goes out 3/4 of the way in the installation. I start it and say my computer may not be to the highest ranking of any idea?

    trying to high grade from vista to 7 and my coputure goes out 3/4 of the way in the installation. I start it and say my computer may not be to the highest ranking of any idea? I got a microsoft tec tring to understand with a bit of luck again!

    Hello

    in this case, contact the HP support

    http://h10025.www1.HP.com/ewfrf/wc/contacthp?LC=en&DLC=en&cc=us

    or HP Support forums

    http://h30434.www3.HP.com/

    or repost in the correct forum for windows 7 that I have already advised you to do

  • Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec. Windows Vista operating system.

    Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec.  Windows Vista operating system.

    Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec.  Windows Vista operating system.

    ==============================
    The following thread explains how to convert
    the files to a different format... iTunes then
    You should be able to import them.

    Need help to convert itunes to Windows Media
    http://social.answers.Microsoft.com/forums/en-us/vistamedia/thread/f496ae8e-d3f9-4336-BB3C-8070421c8eff
    (Scroll to the bottom to detach the message by: musiclover101)

    Or... use the following freeware to convert your
    already downloaded files to the .wma format.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Format Factory
    http://www.pcfreetime.com/
    (FWIW... installation..., you can uncheck
    all the boxes on the last screen)

    After downloading and installing Format Factory...
    Open the program and choose an output folder...
    (this is where you will find your files when they are
    converted)

    Drag and drop your files in iTunes on the main screen...

    Select "while"WMA"/ OK...

    Click on... Beginning... in the toolbar...

    That should do it...

    Good luck...

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • I am trying to transfer photos from pc to ipad

    I am trying to transfer photos from pc to ipad and get the error message "device has stopped responding or has been disconnected, when is has not been disconnected." Help!

    The easiest way is to download itunes,

    http://www.Apple.com/iTunes/

Maybe you are looking for

  • a bug keeps opening pages and my current malware and anti virus can't find it

    Ive been hunting something that makes pop pages up to different and these ads sites and its really annoying and I'm sure his slow FF down. I have Malwarebytes, Spybot and AVG all work, and they find nothing. Between this gene constant issues flash an

  • Battery packs cables and Anker

    Oke, use non-certified cables can damage your iPhone but what about a pack of battery Anker? And if I use original cables and taken, but what happens if I extend the cable with an extra USB cable? Belkin certified? When I tried to update the firmware

  • Equium A210-17I turn off randomly

    Hello My laptop is a little more than two years now. Since just after Christmas there now randomly turned off itself several times. Basically the screen turns off, standby-led is orange regular and the hard drive light flashes very quickly. Even when

  • Pavilion 15-ac041ne: problem with the installation of Lan & Wifi driver

    Hello... I recently bought Pavilion 15-ac041ne laptop. I installed a new copy of windows 7 64 bit, but when I tried to install the lan and wifi drivers she had failed. I tried all the ad Lan drivers WiFi here given in the database. I also checked the

  • Change a word or acronym in each file in a folder without having to open each file separately.

    Is it possible to change a JSST to BBST in every file in a folder without physically open all files in the folder and do a find & replace?  Under MVS, Unix, BACK 3.0 and CP/M I was able and/or may.  I have at least 6 files with between 20 and 100 fil