Beispiel #1
0
        private SNC_SERVICE_RESULT SncCommand(SNC_SERVICE_COMMAND nCommand, string sInput, out string sResult)
        {
            int nReturnBytes = 0;

            sResult = "";
            var pOutput = Marshal.AllocHGlobal(65535);

            try
            {
                return(snc_command(nCommand, sInput.ToArray(), sInput.Length, pOutput, 65535, out nReturnBytes));
            }
            catch
            {
                nReturnBytes = 0;
                return(SNC_SERVICE_RESULT.SNC_SERVICE_RESULT_ERROR_OPERATION_FAILED);
            }
            finally
            {
                if (nReturnBytes > 0)
                {
                    sResult = Marshal.PtrToStringAnsi(pOutput);
                }
                Marshal.FreeHGlobal(pOutput);
            }
        }
Beispiel #2
0
 private extern static SNC_SERVICE_RESULT snc_command(SNC_SERVICE_COMMAND nCommand, char[] pInputData, int nInputSize, IntPtr pOutputData, int nOutputSize, out int pnReturnBytes);