コード例 #1
0
ファイル: Prov.cs プロジェクト: JeffreyZksun/gpstranslator
		public static PROV_ENUMALGS_EX [] GetProvAlgsEx(IntPtr prov)
		{
			ArrayList retAl = GetProvParam(prov, ProvParamEnum.ALGS_EX, 148);
			ArrayList al = new ArrayList();
			foreach(byte [] ba in retAl)
			{
				PROV_ENUMALGS_EX pe = new PROV_ENUMALGS_EX();
				pe.aiAlgid = BitConverter.ToUInt32(ba, 0);
				pe.dwDefaultLen = BitConverter.ToUInt32(ba, 4);
				pe.dwMinLen = BitConverter.ToUInt32(ba, 8);
				pe.dwMaxLen = BitConverter.ToUInt32(ba, 12);
				pe.dwProtocols = BitConverter.ToUInt32(ba, 16);
				pe.dwNameLen = BitConverter.ToUInt32(ba, 20);
				int nameLen = (int) (pe.dwNameLen * 2) -1 ; //nullTerm
				if(nameLen > 0)
					pe.szName = Encoding.Unicode.GetString(ba, 24, nameLen);
				pe.dwLongNameLen = BitConverter.ToUInt32(ba, 44);
				nameLen = (int) (pe.dwLongNameLen * 2) - 1; //nullTerm
				if(nameLen > 0)
				{
					nameLen = Math.Min(80, nameLen);
					pe.szLongName = Encoding.Unicode.GetString(ba, 48, nameLen);
				}
				if(pe.aiAlgid != 0)
					al.Add(pe);
			}
			PROV_ENUMALGS_EX [] pea = new PROV_ENUMALGS_EX[al.Count];
			al.CopyTo(0, pea, 0, pea.Length);
			return pea;
		}
コード例 #2
0
        public static PROV_ENUMALGS_EX [] GetProvAlgsEx(IntPtr prov)
        {
            ArrayList retAl = GetProvParam(prov, ProvParamEnum.ALGS_EX, 148);
            ArrayList al    = new ArrayList();

            foreach (byte [] ba in retAl)
            {
                PROV_ENUMALGS_EX pe = new PROV_ENUMALGS_EX();
                pe.aiAlgid      = BitConverter.ToUInt32(ba, 0);
                pe.dwDefaultLen = BitConverter.ToUInt32(ba, 4);
                pe.dwMinLen     = BitConverter.ToUInt32(ba, 8);
                pe.dwMaxLen     = BitConverter.ToUInt32(ba, 12);
                pe.dwProtocols  = BitConverter.ToUInt32(ba, 16);
                pe.dwNameLen    = BitConverter.ToUInt32(ba, 20);
                int nameLen = (int)(pe.dwNameLen * 2) - 1;                  //nullTerm
                if (nameLen > 0)
                {
                    pe.szName = Encoding.Unicode.GetString(ba, 24, nameLen);
                }
                pe.dwLongNameLen = BitConverter.ToUInt32(ba, 44);
                nameLen          = (int)(pe.dwLongNameLen * 2) - 1;         //nullTerm
                if (nameLen > 0)
                {
                    nameLen       = Math.Min(80, nameLen);
                    pe.szLongName = Encoding.Unicode.GetString(ba, 48, nameLen);
                }
                if (pe.aiAlgid != 0)
                {
                    al.Add(pe);
                }
            }
            PROV_ENUMALGS_EX [] pea = new PROV_ENUMALGS_EX[al.Count];
            al.CopyTo(0, pea, 0, pea.Length);
            return(pea);
        }