Microchip XC8/XC16/XC32 **

[复制链接]
 楼主| i55 发表于 2013-6-13 14:53 | 显示全部楼层 |阅读模式
复制下列代码,另存为xclm.c,然后用mingw编译(推荐Code::Blocks的ide)生成xclm.exe,然后替换掉安装目录里面的同名文件即可。
  1. /*****************************************************************************
  2. *
  3. * xclm.c - A replacement license server for Microchip embedded compilers
  4. *
  5. *****************************************************************************/

  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <stdlib.h>

  9. enum
  10. {
  11.     LICENSE_FREE,
  12.     LICENSE_STANDARD,
  13.     LICENSE_PRO,
  14.     LICENSE_NULL,
  15.     LICENSE_NOCPP,
  16.     LICENSE_CPPFREE,
  17.     LICENSE_CPPFULL
  18. };

  19. /* Padded keystring for XC8 compiler */
  20. const char XC8_KEY[] = "120205690315959428539973816151144999076498629234049888"
  21.                        "179227155534183820578631309018645587360933525814619915"
  22.                        "779526071941849199599867328321377639683720790016145394"
  23.                        "178294936006671919157552224249424396156390966410329115"
  24.                        "909578096551465127991840510571525598801543710978110203"
  25.                        "982753256678760352233698494166181105701471577863949973"
  26.                        "752378527793703095602570185318279000307654710756304884"
  27.                        "332086971157374238079344503160762531771453544441183117"
  28.                        "818224971852635709182448998796203508335756172022603393"
  29.                        "785870328131267807990054177348691152537065623705744096"
  30.                        "622171290262732073236149224291304052855537234103307757"
  31.                        "779806424202430488281521000914602653822069627155202082"
  32.                        "274335001015294801198690117625951676366998171835575234"
  33.                        "880703719555742347294083595208861666202572853755813079"
  34.                        "282586487282173705566196898952662018776810629200817792"
  35.                        "338135876828426412432431480282173674506720693507626895"
  36.                        "304345939375032966363775750624733239923482883107733905"
  37.                        "27680200757984356120205690";

  38. int main(int argc, char *argv[])
  39. {
  40.     int license = LICENSE_FREE;
  41.     int ii;

  42.     for (ii = 0; ii < argc; ++ii)
  43.     {
  44.         if (!strcmp(argv[ii], "swxc32") ||
  45.             !strcmp(argv[ii], "swxc16") ||
  46.             !strcmp(argv[ii], "swxc8"))
  47.         {
  48.             license = LICENSE_PRO;
  49.         }
  50.         else if (!strcmp(argv[ii], "swxcpp32"))
  51.         {
  52.             license = LICENSE_CPPFULL;
  53.         }
  54.         else if (!strcmp(argv[ii], "-hash"))
  55.         {
  56.             int index = atoi(argv[ii+1]);
  57.             printf("%.10s", &XC8_KEY[index]);
  58.         }
  59.     }

  60.     return license;
  61. }
huangxz 发表于 2013-6-13 15:18 | 显示全部楼层
nevermore008 发表于 2013-6-13 16:11 | 显示全部楼层
会不会出bug,以前用picc的**版出过bug
hexenzhou 发表于 2013-6-13 17:02 | 显示全部楼层
用VC不行吗?
LingTian 发表于 2013-6-23 22:40 | 显示全部楼层
可以用的吗?
l4157 发表于 2013-6-23 22:49 | 显示全部楼层
试过,貌似可以...
 楼主| i55 发表于 2013-7-29 13:21 | 显示全部楼层
  1. #include <stdlib.h>
  2. #include <stdio.h>

  3. static char asTable[] = "12020569031595942853997381615114499907649862923404988817922715553418382057863130"
  4.                         "90186455873609335258146199157795260719418491995998673283213776396837207900161453"
  5.                         "94178294936006671919157552224249424396156390966410329115909578096551465127991840"
  6.                         "51057152559880154371097811020398275325667876035223369849416618110570147157786394"
  7.                         "99737523785277937030956025701853182790003076547107563048843320869711573742380793"
  8.                         "44503160762531771453544441183117818224971852635709182448998796203508335756172022"
  9.                         "60339378587032813126780799005417734869115253706562370574409662217129026273207323"
  10.                         "61492242913040528555372341033077577798064242024304882815210009146026538220696271"
  11.                         "55202082274335001015294801198690117625951676366998171835575234880703719555742347"
  12.                         "29408359520886166620257285375581307928258648728217370556619689895266201877681062"
  13.                         "92008177923381358768284264124324314802821736745067206935076268953043459393750329"
  14.                         "6636377575062473323992348288310773390527680200757984356";

  15. void printHash(int iHash);

  16. int main(int iArgc,char *asArg[])
  17. {
  18.     int iHash = -1;
  19.     int iNdx = 0;
  20.     unsigned char bPrint = 0;
  21.     int iExit = 2;

  22.     for(iNdx=0;iNdx<iArgc;iNdx++)
  23.     {
  24.         if(!strcmp(asArg[iNdx],"swxc8"))
  25.             bPrint = 1;
  26.         if(!strcmp(asArg[iNdx],"-hash") && (iNdx+1)<iArgc)
  27.             iHash = atoi(asArg[iNdx+1]);
  28.         if(!strcmp(asArg[iNdx],"-licenseinfo"))
  29.         {
  30.             printf("Node Configuration\n");
  31.             iExit = 0;
  32.             break;
  33.         }
  34.     }

  35.     if(bPrint && iHash!=-1)
  36.         printHash(iHash);

  37.     return iExit;
  38. }
  39. void printHash(int iHash)
  40. {
  41.     int iNdx = 0;

  42.     for(iNdx=0;iNdx<9;iNdx++)
  43.     {
  44.         int iPointer = iHash - (((((0x8c2f17d3L * (long long)iHash) >> 32) >> 9) - (iHash >> 0x1F)) * 0x3A7);
  45.         printf("%c",asTable[iPointer]);
  46.         iHash++;
  47.     }
  48. }

评分

参与人数 1威望 +1 收起 理由
ljsimu + 1 赞一个!

查看全部评分

aeqw 发表于 2013-8-6 18:52 | 显示全部楼层
雖然挺麻煩的!!
不過至少還不錯用呢!!
分享我編譯好的東西~
省得大家麻煩!!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

参与人数 4威望 +11 收起 理由
greensyz + 1 很给力!
forTheOne + 1 赞一个!
木瓜498283984 + 3
dong_abc + 6 赞一个!

查看全部评分

aeqw 发表于 2013-8-6 18:53 | 显示全部楼层
第二個源碼...
看起來好像效果一樣?
目前感覺不出有啥區別...

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

参与人数 1威望 +6 收起 理由
dong_abc + 6 赞一个!

查看全部评分

l4157 发表于 2013-8-15 10:56 | 显示全部楼层
aeqw 发表于 2013-8-6 18:53
第二個源碼...
看起來好像效果一樣?
目前感覺不出有啥區別...

XCLM2 好像能**1.20
ljq200 发表于 2013-8-15 15:27 | 显示全部楼层
谢谢分享!
hemporer 发表于 2013-8-22 19:35 | 显示全部楼层
这种方法很牛
但只能忽悠MPLAB IDE
不能忽悠MPLAB X IDE呀
大侠们还得努力
还有进步空间哦
michaelxcj 发表于 2013-8-27 10:51 | 显示全部楼层
l4157 发表于 2013-8-15 10:56
XCLM2 好像能**1.20

@14157,试过没有?怎么查看?
michaelxcj 发表于 2013-8-27 10:56 | 显示全部楼层
hemporer 发表于 2013-8-22 19:35
这种方法很牛
但只能忽悠MPLAB IDE
不能忽悠MPLAB X IDE呀

MPLAB IDE能**吗?怎么确认是不是**了
michaelxcj 发表于 2013-8-27 11:00 | 显示全部楼层
是不是运行xc8 --ver后,显示
Microchip MPLAB XC8 C Compiler V1.20
Copyright (C) 2013 Microchip Technology Inc.
就证明是**了,有没有人可以确认一下?
l4157 发表于 2013-8-27 21:33 | 显示全部楼层
michaelxcj 发表于 2013-8-27 10:51
@14157,试过没有?怎么查看?

Microchip MPLAB XC8 C Compiler V1.20
Copyright (C) 2013 Microchip Technology Inc.
License type: Node Configuration


Memory Summary:
    Program space        used   245h (   581) of   400h words   ( 56.7%)
    Data space           used    17h (    23) of    40h bytes   ( 35.9%)
    EEPROM space         None available
    Configuration bits   used     2h (     2) of     2h words   (100.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)
dong_abc 发表于 2013-8-27 23:15 | 显示全部楼层
收藏
michaelxcj 发表于 2013-8-28 09:29 | 显示全部楼层
l4157 发表于 2013-8-27 21:33
Microchip MPLAB XC8 C Compiler V1.20
Copyright (C) 2013 Microchip Technology Inc.
License type: No ...

我的意思是,怎么确认是不是试用PRO版本?我是8月22日装的,我要确认2个月后是不是就到期了?还是永久是PRO版本的
李富贵 发表于 2013-8-28 14:53 | 显示全部楼层
aeqw 发表于 2013-8-6 18:53
第二個源碼...
看起來好像效果一樣?
目前感覺不出有啥區別...

第一个是Floating Workstation,第二个是Nodelocked License,显示的授权许可明显不同。
亚历山大Y 发表于 2013-8-28 15:41 | 显示全部楼层
顶起
您需要登录后才可以回帖 登录 | 注册

本版积分规则

i55
个人签名:诸葛一生唯补肾 吕端房事不糊涂 虽然我不是基督徒,但你可以用身体传福音给我,我必有所感动。

28

主题

750

帖子

6

粉丝
快速回复 在线客服 返回列表 返回顶部